-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into feat-package-class-validator-support
- Loading branch information
Showing
39 changed files
with
1,904 additions
and
1,188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,7 @@ describe('Bulk create subscribers - /v1/subscribers/bulk (POST)', function () { | |
} | ||
}); | ||
|
||
it('should allow recreate deleted subscribers', async function () { | ||
it('should recreate deleted subscribers', async function () { | ||
const existingSubscriber = { subscriberId: subscriber.subscriberId, firstName: 'existingSubscriber' }; | ||
const newSubscriber1 = { | ||
subscriberId: 'test1', | ||
|
@@ -153,7 +153,7 @@ describe('Bulk create subscribers - /v1/subscribers/bulk (POST)', function () { | |
firstName: 'sub2', | ||
email: '[email protected]', | ||
}; | ||
const { data: body } = await axiosInstance.post( | ||
const { data: firstResponseData } = await axiosInstance.post( | ||
`${session.serverUrl}${BULK_API_ENDPOINT}`, | ||
{ | ||
subscribers: [existingSubscriber, newSubscriber1, newSubscriber2], | ||
|
@@ -164,19 +164,13 @@ describe('Bulk create subscribers - /v1/subscribers/bulk (POST)', function () { | |
}, | ||
} | ||
); | ||
expect(body.data).to.be.ok; | ||
|
||
const { | ||
data: { updated, created }, | ||
} = body; | ||
expect(firstResponseData.data.created?.length).to.equal(2); | ||
expect(firstResponseData.data.updated?.length).to.equal(1); | ||
expect(firstResponseData.data.created[0].subscriberId).to.equal(newSubscriber1.subscriberId); | ||
expect(firstResponseData.data.created[1].subscriberId).to.equal(newSubscriber2.subscriberId); | ||
expect(firstResponseData.data.updated[0].subscriberId).to.equal(existingSubscriber.subscriberId); | ||
|
||
expect(updated?.length).to.equal(1); | ||
expect(created?.length).to.equal(2); | ||
expect(updated[0].subscriberId).to.equal(existingSubscriber.subscriberId); | ||
expect(created[0].subscriberId).to.equal(newSubscriber1.subscriberId); | ||
expect(created[1].subscriberId).to.equal(newSubscriber2.subscriberId); | ||
|
||
// delete the two created subscribers | ||
await axiosInstance.delete(`${session.serverUrl}/v1/subscribers/${newSubscriber1.subscriberId}`, { | ||
headers: { | ||
authorization: `ApiKey ${session.apiKey}`, | ||
|
@@ -188,8 +182,7 @@ describe('Bulk create subscribers - /v1/subscribers/bulk (POST)', function () { | |
}, | ||
}); | ||
|
||
// recreate the deleted subscribers | ||
const { data: recreateBody } = await axiosInstance.post( | ||
const { data: secondResponseData } = await axiosInstance.post( | ||
`${session.serverUrl}${BULK_API_ENDPOINT}`, | ||
{ | ||
subscribers: [existingSubscriber, newSubscriber1, newSubscriber2], | ||
|
@@ -201,26 +194,10 @@ describe('Bulk create subscribers - /v1/subscribers/bulk (POST)', function () { | |
} | ||
); | ||
|
||
expect(recreateBody.data).to.be.ok; | ||
const { | ||
data: { updated: updatedAgain }, | ||
} = recreateBody; | ||
|
||
expect(updatedAgain?.length).to.equal(3); | ||
expect(updatedAgain[0].subscriberId).to.equal(existingSubscriber.subscriberId); | ||
expect(updatedAgain[1].subscriberId).to.equal(newSubscriber1.subscriberId); | ||
expect(updatedAgain[2].subscriberId).to.equal(newSubscriber2.subscriberId); | ||
|
||
// check that they are not marked as deleted | ||
const recreatedSubscriber1 = await subscriberRepository.findBySubscriberId( | ||
session.environment._id, | ||
newSubscriber1.subscriberId | ||
); | ||
const recreatedSubscriber2 = await subscriberRepository.findBySubscriberId( | ||
session.environment._id, | ||
newSubscriber2.subscriberId | ||
); | ||
expect(recreatedSubscriber1.deleted).to.be.false; | ||
expect(recreatedSubscriber2.deleted).to.be.false; | ||
expect(secondResponseData.data.created?.length).to.equal(2); | ||
expect(secondResponseData.data.updated?.length).to.equal(1); | ||
expect(secondResponseData.data.created[0].subscriberId).to.equal(newSubscriber1.subscriberId); | ||
expect(secondResponseData.data.created[1].subscriberId).to.equal(newSubscriber2.subscriberId); | ||
expect(secondResponseData.data.updated[0].subscriberId).to.equal(existingSubscriber.subscriberId); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/dashboard/src/components/workflow-editor/steps/controls/custom-step-controls.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useState } from 'react'; | ||
import { RJSFSchema } from '@rjsf/utils'; | ||
import { RiArrowDownSLine, RiArrowUpSLine, RiInputField } from 'react-icons/ri'; | ||
import { type ControlsMetadata } from '@novu/shared'; | ||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/primitives/collapsible'; | ||
import { JsonForm } from './json-form'; | ||
|
||
export function CustomStepControls({ dataSchema }: { dataSchema: ControlsMetadata['dataSchema'] }) { | ||
const [isEditorOpen, setIsEditorOpen] = useState(true); | ||
|
||
if (!dataSchema) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Collapsible | ||
open={isEditorOpen} | ||
onOpenChange={setIsEditorOpen} | ||
className="bg-neutral-alpha-50 border-neutral-alpha-200 flex w-full flex-col gap-2 rounded-lg border p-2" | ||
> | ||
<CollapsibleTrigger className="flex w-full items-center justify-between text-sm"> | ||
<div className="flex items-center gap-1"> | ||
<RiInputField className="text-feature size-5" /> | ||
<span className="text-sm font-medium">Custom steps controls</span> | ||
</div> | ||
|
||
{isEditorOpen ? ( | ||
<RiArrowUpSLine className="text-neutral-alpha-400 size-5" /> | ||
) : ( | ||
<RiArrowDownSLine className="text-neutral-alpha-400 size-5" /> | ||
)} | ||
</CollapsibleTrigger> | ||
|
||
<CollapsibleContent> | ||
<div className="bg-background rounded-md border border-dashed px-3 py-0"> | ||
<JsonForm schema={(dataSchema as RJSFSchema) || {}} variables={[]} /> | ||
</div> | ||
</CollapsibleContent> | ||
</Collapsible> | ||
); | ||
} |
Oops, something went wrong.