ddd-ts-kit 0.100.0 → 0.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.fr.md +14 -7
- package/README.md +13 -6
- package/dist/check/fixtures/privacy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/privacy-fixtures.js +22 -0
- package/dist/check/fixtures/privacy-fixtures.js.map +1 -1
- package/dist/check/privacy/published-events-of.d.ts.map +1 -1
- package/dist/check/privacy/published-events-of.js +4 -2
- package/dist/check/privacy/published-events-of.js.map +1 -1
- package/dist/check/schemas/class-shapes.d.ts.map +1 -1
- package/dist/check/schemas/class-shapes.js +5 -26
- package/dist/check/schemas/class-shapes.js.map +1 -1
- package/dist/check/structure/class-statements.d.ts +13 -0
- package/dist/check/structure/class-statements.d.ts.map +1 -0
- package/dist/check/structure/class-statements.js +34 -0
- package/dist/check/structure/class-statements.js.map +1 -0
- package/dist/check/structure/property-of.d.ts +13 -0
- package/dist/check/structure/property-of.d.ts.map +1 -0
- package/dist/check/structure/property-of.js +23 -0
- package/dist/check/structure/property-of.js.map +1 -0
- package/dist/describe/read-event-definitions.d.ts +2 -0
- package/dist/describe/read-event-definitions.d.ts.map +1 -1
- package/dist/describe/read-event-definitions.js +1 -0
- package/dist/describe/read-event-definitions.js.map +1 -1
- package/dist/generate/flags-of.d.ts +4 -0
- package/dist/generate/flags-of.d.ts.map +1 -0
- package/dist/generate/flags-of.js +6 -0
- package/dist/generate/flags-of.js.map +1 -0
- package/dist/generate/held-to-glossary.d.ts +9 -0
- package/dist/generate/held-to-glossary.d.ts.map +1 -0
- package/dist/generate/held-to-glossary.js +11 -0
- package/dist/generate/held-to-glossary.js.map +1 -0
- package/dist/generate/kind-help.d.ts +2 -0
- package/dist/generate/kind-help.d.ts.map +1 -1
- package/dist/generate/kind-help.js +2 -0
- package/dist/generate/kind-help.js.map +1 -1
- package/dist/generate/kinds/adapter-kind.js +1 -1
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/background/class-payload-schema.js +3 -3
- package/dist/generate/kinds/background/class-payload-schema.js.map +1 -1
- package/dist/generate/kinds/background-job-kind.js +1 -1
- package/dist/generate/kinds/background-job-kind.js.map +1 -1
- package/dist/generate/kinds/builder-kind.js +1 -1
- package/dist/generate/kinds/builder-kind.js.map +1 -1
- package/dist/generate/kinds/command-kind.js +1 -1
- package/dist/generate/kinds/command-kind.js.map +1 -1
- package/dist/generate/kinds/declarations-of.d.ts +11 -0
- package/dist/generate/kinds/declarations-of.d.ts.map +1 -0
- package/dist/generate/kinds/declarations-of.js +17 -0
- package/dist/generate/kinds/declarations-of.js.map +1 -0
- package/dist/generate/kinds/e2e-kind.js +1 -1
- package/dist/generate/kinds/e2e-kind.js.map +1 -1
- package/dist/generate/kinds/erasure-handler-kind.js +1 -1
- package/dist/generate/kinds/erasure-handler-kind.js.map +1 -1
- package/dist/generate/kinds/event-type-as-published.d.ts +11 -0
- package/dist/generate/kinds/event-type-as-published.d.ts.map +1 -0
- package/dist/generate/kinds/event-type-as-published.js +17 -0
- package/dist/generate/kinds/event-type-as-published.js.map +1 -0
- package/dist/generate/kinds/form-kind.js +1 -1
- package/dist/generate/kinds/form-kind.js.map +1 -1
- package/dist/generate/kinds/integration-event-kind.d.ts.map +1 -1
- package/dist/generate/kinds/integration-event-kind.js +2 -9
- package/dist/generate/kinds/integration-event-kind.js.map +1 -1
- package/dist/generate/kinds/integration-handler-kind.d.ts.map +1 -1
- package/dist/generate/kinds/integration-handler-kind.js +30 -14
- package/dist/generate/kinds/integration-handler-kind.js.map +1 -1
- package/dist/generate/kinds/job-kind.js +1 -1
- package/dist/generate/kinds/job-kind.js.map +1 -1
- package/dist/generate/kinds/module-kind.js +1 -1
- package/dist/generate/kinds/module-kind.js.map +1 -1
- package/dist/generate/kinds/parse-version.d.ts +3 -0
- package/dist/generate/kinds/parse-version.d.ts.map +1 -0
- package/dist/generate/kinds/parse-version.js +9 -0
- package/dist/generate/kinds/parse-version.js.map +1 -0
- package/dist/generate/kinds/pick-declaration.d.ts +9 -0
- package/dist/generate/kinds/pick-declaration.d.ts.map +1 -0
- package/dist/generate/kinds/pick-declaration.js +14 -0
- package/dist/generate/kinds/pick-declaration.js.map +1 -0
- package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -1
- package/dist/generate/kinds/presentation/controller-of.js +15 -5
- package/dist/generate/kinds/presentation/controller-of.js.map +1 -1
- package/dist/generate/kinds/projection-kind.d.ts.map +1 -1
- package/dist/generate/kinds/projection-kind.js +21 -12
- package/dist/generate/kinds/projection-kind.js.map +1 -1
- package/dist/generate/kinds/property-kind.js +1 -1
- package/dist/generate/kinds/property-kind.js.map +1 -1
- package/dist/generate/kinds/refuse-unpublished-version.d.ts +7 -0
- package/dist/generate/kinds/refuse-unpublished-version.d.ts.map +1 -0
- package/dist/generate/kinds/refuse-unpublished-version.js +15 -0
- package/dist/generate/kinds/refuse-unpublished-version.js.map +1 -0
- package/dist/generate/kinds/repository-kind.js +1 -1
- package/dist/generate/kinds/repository-kind.js.map +1 -1
- package/dist/generate/kinds/representation-kind.js +1 -1
- package/dist/generate/kinds/representation-kind.js.map +1 -1
- package/dist/generate/kinds/route/message-vars.d.ts.map +1 -1
- package/dist/generate/kinds/route/message-vars.js +5 -2
- package/dist/generate/kinds/route/message-vars.js.map +1 -1
- package/dist/generate/kinds/route/route-vars.js +1 -1
- package/dist/generate/kinds/route/route-vars.js.map +1 -1
- package/dist/generate/kinds/route/spec-vars.d.ts +2 -1
- package/dist/generate/kinds/route/spec-vars.d.ts.map +1 -1
- package/dist/generate/kinds/route/spec-vars.js +26 -7
- package/dist/generate/kinds/route/spec-vars.js.map +1 -1
- package/dist/generate/kinds/route-group-kind.js +1 -1
- package/dist/generate/kinds/route-group-kind.js.map +1 -1
- package/dist/generate/kinds/route-kind.js +2 -2
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds/state-machine-kind.js +1 -1
- package/dist/generate/kinds/state-machine-kind.js.map +1 -1
- package/dist/generate/kinds/wanted-event.d.ts +6 -0
- package/dist/generate/kinds/wanted-event.d.ts.map +1 -0
- package/dist/generate/kinds/wanted-event.js +2 -0
- package/dist/generate/kinds/wanted-event.js.map +1 -0
- package/dist/generate/refuse-undeclared-flags.d.ts.map +1 -1
- package/dist/generate/refuse-undeclared-flags.js +9 -2
- package/dist/generate/refuse-undeclared-flags.js.map +1 -1
- package/dist/help/kind-help-text.d.ts.map +1 -1
- package/dist/help/kind-help-text.js +24 -13
- package/dist/help/kind-help-text.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/stack/http-cache-misfit.d.ts +4 -0
- package/dist/init/stack/http-cache-misfit.d.ts.map +1 -0
- package/dist/init/stack/http-cache-misfit.js +21 -0
- package/dist/init/stack/http-cache-misfit.js.map +1 -0
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +2 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/templates/controller/controller.spec.ts.tpl +19 -0
- package/templates/integration-event/payload.class-validator.ts.tpl +2 -2
- package/templates/nest-controller/controller.spec.ts.tpl +25 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.body.class-validator.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.body.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.body.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.body.class-validator.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.params.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.body.class-validator.ts.tpl +4 -4
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.params.class-validator.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.accepted.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.body.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.params.class-validator.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.body.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.params.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.params.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.params.class-validator.ts.tpl +2 -2
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.line.class-validator.ts.tpl +6 -6
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.params.class-validator.ts.tpl +1 -1
- package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.class-validator.shared.ts.tpl +1 -1
- package/templates/presets/identity/context/published-language/account-deactivated.v1.payload.class-validator.ts.tpl +1 -1
- package/templates/presets/identity/context/published-language/delegation-granted.v1.payload.class-validator.ts.tpl +7 -7
- package/templates/presets/identity/context/published-language/delegation-revoked.v1.payload.class-validator.ts.tpl +4 -4
- package/templates/presets/identity/context/published-language/member-joined.v1.payload.class-validator.ts.tpl +4 -4
- package/templates/presets/identity/context/published-language/member-removed.v1.payload.class-validator.ts.tpl +4 -4
- package/templates/presets/identity/context/published-language/member-role-changed.v1.payload.class-validator.ts.tpl +6 -6
- package/templates/presets/identity/context/published-language/organisation-opened.v1.payload.class-validator.ts.tpl +3 -3
- package/templates/route/dto.accepted.ts.tpl +1 -1
- package/templates/route/dto.answer.ts.tpl +1 -1
- package/templates/route/dto.body.ts.tpl +1 -1
- package/templates/route/dto.line.ts.tpl +2 -2
- package/templates/route/route.spec.ts.tpl +19 -0
- package/templates/schema/schema.class-validator.ts.tpl +1 -1
- package/dist/generate/kinds/find-event-declaration.d.ts +0 -8
- package/dist/generate/kinds/find-event-declaration.d.ts.map +0 -1
- package/dist/generate/kinds/find-event-declaration.js +0 -27
- package/dist/generate/kinds/find-event-declaration.js.map +0 -1
|
@@ -3,8 +3,8 @@ import { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vo
|
|
|
3
3
|
|
|
4
4
|
export class InviteMemberBody {
|
|
5
5
|
@IsEmail()
|
|
6
|
-
email
|
|
6
|
+
declare email: string;
|
|
7
7
|
|
|
8
8
|
@IsIn(Object.values(MemberRole))
|
|
9
|
-
role: MemberRole
|
|
9
|
+
declare role: MemberRole;
|
|
10
10
|
}
|
|
@@ -4,9 +4,9 @@ export class OpenOrganisationBody {
|
|
|
4
4
|
/** Lower-case letters, digits and hyphens: the identifier of the organisation, for good. */
|
|
5
5
|
@IsString()
|
|
6
6
|
@IsNotEmpty()
|
|
7
|
-
slug
|
|
7
|
+
declare slug: string;
|
|
8
8
|
|
|
9
9
|
@IsString()
|
|
10
10
|
@IsNotEmpty()
|
|
11
|
-
name
|
|
11
|
+
declare name: string;
|
|
12
12
|
}
|
|
@@ -3,9 +3,9 @@ import { IsNotEmpty, IsString } from 'class-validator';
|
|
|
3
3
|
export class RemoveMemberParams {
|
|
4
4
|
@IsString()
|
|
5
5
|
@IsNotEmpty()
|
|
6
|
-
organisationId
|
|
6
|
+
declare organisationId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
9
|
@IsNotEmpty()
|
|
10
|
-
accountId
|
|
10
|
+
declare accountId: string;
|
|
11
11
|
}
|
|
@@ -3,9 +3,9 @@ import { IsNotEmpty, IsString } from 'class-validator';
|
|
|
3
3
|
export class RevokeDelegationParams {
|
|
4
4
|
@IsString()
|
|
5
5
|
@IsNotEmpty()
|
|
6
|
-
organisationId
|
|
6
|
+
declare organisationId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
9
|
@IsNotEmpty()
|
|
10
|
-
delegationId
|
|
10
|
+
declare delegationId: string;
|
|
11
11
|
}
|
|
@@ -3,9 +3,9 @@ import { IsNotEmpty, IsString } from 'class-validator';
|
|
|
3
3
|
export class RevokeInvitationParams {
|
|
4
4
|
@IsString()
|
|
5
5
|
@IsNotEmpty()
|
|
6
|
-
organisationId
|
|
6
|
+
declare organisationId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
9
|
@IsNotEmpty()
|
|
10
|
-
invitationId
|
|
10
|
+
declare invitationId: string;
|
|
11
11
|
}
|
|
@@ -3,20 +3,20 @@ import { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vo
|
|
|
3
3
|
|
|
4
4
|
export class SearchMembersLine {
|
|
5
5
|
@IsString()
|
|
6
|
-
memberId
|
|
6
|
+
declare memberId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
accountId
|
|
9
|
+
declare accountId: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
displayName
|
|
12
|
+
declare displayName: string;
|
|
13
13
|
|
|
14
14
|
@IsEmail()
|
|
15
|
-
email
|
|
15
|
+
declare email: string;
|
|
16
16
|
|
|
17
17
|
@IsIn(Object.values(MemberRole))
|
|
18
|
-
role
|
|
18
|
+
declare role: MemberRole;
|
|
19
19
|
|
|
20
20
|
@IsISO8601()
|
|
21
|
-
joinedAt
|
|
21
|
+
declare joinedAt: string;
|
|
22
22
|
}
|
|
@@ -3,5 +3,5 @@ import { IsString } from 'class-validator';
|
|
|
3
3
|
/** An account was deactivated: its person signs in no more, and every context stops acting for it. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class AccountDeactivatedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
accountId
|
|
6
|
+
declare accountId: string;
|
|
7
7
|
}
|
|
@@ -3,26 +3,26 @@ import { IsArray, IsISO8601, IsString } from 'class-validator';
|
|
|
3
3
|
/** A member lent rights to another member of the organisation, from an instant to another. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class DelegationGrantedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
delegationId
|
|
6
|
+
declare delegationId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
organisationId
|
|
9
|
+
declare organisationId: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
delegatorId
|
|
12
|
+
declare delegatorId: string;
|
|
13
13
|
|
|
14
14
|
@IsString()
|
|
15
|
-
delegateId
|
|
15
|
+
declare delegateId: string;
|
|
16
16
|
|
|
17
17
|
@IsArray()
|
|
18
18
|
@IsString({ each: true })
|
|
19
|
-
rights: string[]
|
|
19
|
+
declare rights: string[];
|
|
20
20
|
|
|
21
21
|
/** An ISO 8601 instant. */
|
|
22
22
|
@IsISO8601()
|
|
23
|
-
startsAt
|
|
23
|
+
declare startsAt: string;
|
|
24
24
|
|
|
25
25
|
/** An ISO 8601 instant. */
|
|
26
26
|
@IsISO8601()
|
|
27
|
-
endsAt
|
|
27
|
+
declare endsAt: string;
|
|
28
28
|
}
|
|
@@ -3,14 +3,14 @@ import { IsString } from 'class-validator';
|
|
|
3
3
|
/** A delegation ended before its period: what it lent, the delegate holds no more. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class DelegationRevokedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
delegationId
|
|
6
|
+
declare delegationId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
organisationId
|
|
9
|
+
declare organisationId: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
delegatorId
|
|
12
|
+
declare delegatorId: string;
|
|
13
13
|
|
|
14
14
|
@IsString()
|
|
15
|
-
delegateId
|
|
15
|
+
declare delegateId: string;
|
|
16
16
|
}
|
|
@@ -3,14 +3,14 @@ import { IsString } from 'class-validator';
|
|
|
3
3
|
/** An account became a member of an organisation, in a role. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class MemberJoinedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
memberId
|
|
6
|
+
declare memberId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
organisationId
|
|
9
|
+
declare organisationId: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
accountId
|
|
12
|
+
declare accountId: string;
|
|
13
13
|
|
|
14
14
|
@IsString()
|
|
15
|
-
role
|
|
15
|
+
declare role: string;
|
|
16
16
|
}
|
|
@@ -3,16 +3,16 @@ import { IsOptional, IsString } from 'class-validator';
|
|
|
3
3
|
/** A member left an organisation: what they reached there through it, they reach no more. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class MemberRemovedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
memberId
|
|
6
|
+
declare memberId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
organisationId
|
|
9
|
+
declare organisationId: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
accountId
|
|
12
|
+
declare accountId: string;
|
|
13
13
|
|
|
14
14
|
/** The delegation that lent the right to decide it, when the role of who decided did not grant it. */
|
|
15
15
|
@IsOptional()
|
|
16
16
|
@IsString()
|
|
17
|
-
delegationId?: string;
|
|
17
|
+
declare delegationId?: string;
|
|
18
18
|
}
|
|
@@ -3,22 +3,22 @@ import { IsOptional, IsString } from 'class-validator';
|
|
|
3
3
|
/** The role of a member of an organisation changed. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class MemberRoleChangedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
memberId
|
|
6
|
+
declare memberId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
organisationId
|
|
9
|
+
declare organisationId: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
accountId
|
|
12
|
+
declare accountId: string;
|
|
13
13
|
|
|
14
14
|
@IsString()
|
|
15
|
-
from
|
|
15
|
+
declare from: string;
|
|
16
16
|
|
|
17
17
|
@IsString()
|
|
18
|
-
to
|
|
18
|
+
declare to: string;
|
|
19
19
|
|
|
20
20
|
/** The delegation that lent the right to decide it, when the role of who decided did not grant it. */
|
|
21
21
|
@IsOptional()
|
|
22
22
|
@IsString()
|
|
23
|
-
delegationId?: string;
|
|
23
|
+
declare delegationId?: string;
|
|
24
24
|
}
|
|
@@ -3,11 +3,11 @@ import { IsString } from 'class-validator';
|
|
|
3
3
|
/** An organisation was opened; with tenants, it is a new tenant. Version 1: a field may be added, never renamed nor removed. */
|
|
4
4
|
export class OrganisationOpenedV1Payload {
|
|
5
5
|
@IsString()
|
|
6
|
-
organisationId
|
|
6
|
+
declare organisationId: string;
|
|
7
7
|
|
|
8
8
|
@IsString()
|
|
9
|
-
name
|
|
9
|
+
declare name: string;
|
|
10
10
|
|
|
11
11
|
@IsString()
|
|
12
|
-
openedBy
|
|
12
|
+
declare openedBy: string;
|
|
13
13
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export class {{name.pascal}}Answer {
|
|
2
|
-
// TODO(domain): declare the fields of {{name.pascal}}Result that are part of the public contract, each with its class-validator decorators.
|
|
2
|
+
// TODO(domain): declare the fields of {{name.pascal}}Result that are part of the public contract, each with its class-validator decorators and `declare`d without an initial value.
|
|
3
3
|
}
|
|
@@ -7,6 +7,6 @@ export class {{name.pascal}}Body {
|
|
|
7
7
|
{{/if}}
|
|
8
8
|
{{#unless route.writesBody}}
|
|
9
9
|
export class {{name.pascal}}Body {
|
|
10
|
-
// TODO(domain): declare the fields the client sends for "{{name.words}}", each with its class-validator decorators (shape constraints only; business rules stay in the domain).
|
|
10
|
+
// TODO(domain): declare the fields the client sends for "{{name.words}}", each with its class-validator decorators and `declare`d without an initial value, so that a request without it is refused (shape constraints only; business rules stay in the domain).
|
|
11
11
|
}
|
|
12
12
|
{{/unless}}
|
|
@@ -2,7 +2,7 @@ import { IsString } from 'class-validator';
|
|
|
2
2
|
|
|
3
3
|
export class {{name.pascal}}Line {
|
|
4
4
|
@IsString()
|
|
5
|
-
id
|
|
5
|
+
declare id: string;
|
|
6
6
|
|
|
7
|
-
// TODO(domain): declare the fields of {{name.pascal}}Item that are part of the public contract, each with its class-validator decorators.
|
|
7
|
+
// TODO(domain): declare the fields of {{name.pascal}}Item that are part of the public contract, each with its class-validator decorators and `declare`d without an initial value.
|
|
8
8
|
}
|
|
@@ -17,6 +17,25 @@ describe('{{route.method}} {{route.path}}', () => {
|
|
|
17
17
|
{{route.answerExpectation}}
|
|
18
18
|
{{route.messageExpectation}}
|
|
19
19
|
});
|
|
20
|
+
{{#if route.refusesMissing}}
|
|
21
|
+
|
|
22
|
+
it('refuses a body without `{{route.missingField}}` with 422, naming the field', async () => {
|
|
23
|
+
const {{route.bus}} = new {{route.recordingBus}}();
|
|
24
|
+
const { send } = routeOf({{name.camel}}Route({{route.bus}}));
|
|
25
|
+
|
|
26
|
+
const response = await send({{route.missingRequest}});
|
|
27
|
+
|
|
28
|
+
expect(response).toMatchObject({
|
|
29
|
+
status: 422,
|
|
30
|
+
body: {
|
|
31
|
+
code: 'VALIDATION_FAILED',
|
|
32
|
+
issues: expect.arrayContaining([expect.objectContaining({ path: 'body.{{route.missingField}}' })]),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
expect({{route.bus}}.executed).toEqual([]);
|
|
37
|
+
});
|
|
38
|
+
{{/if}}
|
|
20
39
|
|
|
21
40
|
// TODO(domain): replace each entry below by a test of the same shape, through the same `routeOf` (`{ caller }` names another one, `anonymousActor()` of the kernel nobody).
|
|
22
41
|
it.todo('refuses an input that does not have the expected shape with 422');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export class {{name.pascal}} {
|
|
2
|
-
// TODO(domain): declare the fields of "{{name.words}}" as a client sees them, each with its class-validator decorators (shape constraints only). A route uses the class whole (`classSchema({{name.pascal}}, { shared: true })`), nested (`@ValidateNested()` and `@Type`) or in part (`class Body extends pickClass({{name.pascal}}, [...]) {}`, `omitClass`, `partialClass`); the contract documents it once, as {{name.pascal}}.
|
|
2
|
+
// TODO(domain): declare the fields of "{{name.words}}" as a client sees them, each with its class-validator decorators and `declare`d without an initial value (shape constraints only). A route uses the class whole (`classSchema({{name.pascal}}, { shared: true })`), nested (`@ValidateNested()` and `@Type`, with `@IsDefined()` when it is required: nested validation lets a missing object through) or in part (`class Body extends pickClass({{name.pascal}}, [...]) {}`, `omitClass`, `partialClass`); the contract documents it once, as {{name.pascal}}.
|
|
3
3
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Scope } from '../scope.js';
|
|
2
|
-
import type { EventDeclaration } from './event-declaration.js';
|
|
3
|
-
/**
|
|
4
|
-
* Looks for the declaration of `eventType` in the published language of an upstream of this
|
|
5
|
-
* repository; the file of the one found is what the command builds on.
|
|
6
|
-
*/
|
|
7
|
-
export declare function findEventDeclaration(scope: Scope, upstream: string, eventType: string): EventDeclaration | undefined;
|
|
8
|
-
//# sourceMappingURL=find-event-declaration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-event-declaration.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/find-event-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAwBpH"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Looks for the declaration of `eventType` in the published language of an upstream of this
|
|
3
|
-
* repository; the file of the one found is what the command builds on.
|
|
4
|
-
*/
|
|
5
|
-
export function findEventDeclaration(scope, upstream, eventType) {
|
|
6
|
-
const directory = `${scope.config.contextsDir}/${upstream}/published-language`;
|
|
7
|
-
const declarations = scope.ws.list(directory).flatMap((name) => {
|
|
8
|
-
const file = `${directory}/${name}`;
|
|
9
|
-
const content = scope.ws.read(file) ?? '';
|
|
10
|
-
return content.includes(`type: '${eventType}'`)
|
|
11
|
-
? declarationIn(content).map((declaration) => ({ file, declaration }))
|
|
12
|
-
: [];
|
|
13
|
-
});
|
|
14
|
-
// A new consumer has no reason to start on an old contract.
|
|
15
|
-
const newest = declarations.reduce((found, candidate) => found === undefined || candidate.declaration.version > found.declaration.version ? candidate : found, undefined);
|
|
16
|
-
if (newest !== undefined) {
|
|
17
|
-
scope.flags.builtOn?.(newest.file);
|
|
18
|
-
}
|
|
19
|
-
return newest?.declaration;
|
|
20
|
-
}
|
|
21
|
-
function declarationIn(content) {
|
|
22
|
-
const definition = /export const (\w+) = defineIntegrationEvent\b/.exec(content)?.[1];
|
|
23
|
-
const typeName = /export type (\w+) = IntegrationEvent</.exec(content)?.[1];
|
|
24
|
-
const version = Number(/\bversion:\s*(\d+)/.exec(content)?.[1] ?? '1');
|
|
25
|
-
return definition === undefined || typeName === undefined ? [] : [{ definition, typeName, version }];
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=find-event-declaration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-event-declaration.js","sourceRoot":"","sources":["../../../src/generate/kinds/find-event-declaration.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAY,EAAE,QAAgB,EAAE,SAAiB;IACpF,MAAM,SAAS,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,IAAI,QAAQ,qBAAqB,CAAC;IAE/E,MAAM,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7D,MAAM,IAAI,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAE1C,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,SAAS,GAAG,CAAC;YAC7C,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;YACtE,CAAC,CAAC,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAChC,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CACnB,KAAK,KAAK,SAAS,IAAI,SAAS,CAAC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EACtG,SAAS,CACV,CAAC;IAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,EAAE,WAAW,CAAC;AAC7B,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,UAAU,GAAG,+CAA+C,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,QAAQ,GAAG,uCAAuC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IAEvE,OAAO,UAAU,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACvG,CAAC"}
|