-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1320 Add module TypeScript definitions #2282
base: main
Are you sure you want to change the base?
Conversation
b5d26eb
to
3916290
Compare
3916290
to
6eee5aa
Compare
Hi @samueldmeyer Thanks for the PR. Could you please fix the DCO issue and also attach the issue 1320 like below in the PR above Dev Certificate ? ![]() |
382ada2
to
65fbffe
Compare
@srikant-ch5 I've fixed the DCO issue, updated the message, and rebased on the commits added since I started this PR |
@srikant-ch5 Is there anything else I need to do for this pull request? |
Hi @samueldmeyer -- I think I was supposed to look through this. Apologies for not doing so, I've been concentrating on some of the features you asked for. At first glance I wonder whether we need some tests (presumably Jest tests) to test at least some of this? Also, I think @matthoward366, @nmgokhale and @caritaou should review the Common Properties parts of this since they will need to maintain this Type script API going forward. |
Signed-off-by: Samuel Meyer <[email protected]>
9d8c847
to
b79c89a
Compare
Signed-off-by: Samuel Meyer <[email protected]>
b79c89a
to
df90abe
Compare
@tomlyn I added tests using tsd, which is the standard for TypeScript definitions inside the library. I didn't test everything because a lot of that would simply be a repeat of what is in the definitions, but I did test the parts that are more complicated and generally made it extensible for adding tests. I added the tests to |
Signed-off-by: Samuel Meyer <[email protected]>
7702209
to
c687c20
Compare
Signed-off-by: CTomlyn <[email protected]>
…ies.ts Signed-off-by: CTomlyn <[email protected]>
Signed-off-by: Samuel Meyer <[email protected]>
2de314b
to
afefd24
Compare
@samueldmeyer I have updated test-harness to use Typescript Definitions by updating below in test harness ![]() After making few more changes to the setup I can see that Common Canvas and Common Properties are working fine. Screen.Recording.2025-02-06.at.8.30.56.PM.movIf there are any other ways to test this PR, please feel free to let me know so that I can test the functionality. |
@srikant-ch5 The only way to test TypeScript definitions is to use it with TypeScript code. For that purpose, we have a test file: |
HI @srikant-ch5 -- I am making some changes to this PR. I recommend you pause your work on it for a while, at least until I have pushed my changes. If you have time you could start to think about what tests we could add to |
… TS files Signed-off-by: CTomlyn <[email protected]>
// from JSON. So this creates a PipelineFlowPalette that allows validation. | ||
export type RelaxedPipelineFlowPalette = Omit<PipelineFlowPalette, 'version' | 'categories'> & { | ||
version: string; | ||
categories: unknown[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both version
and categories
need to be optional to allow an existing PipelineFlowPalette to count as valid
/** | ||
* Unique identifier for canvas node within the current pipeline | ||
*/ | ||
id?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really optional? I thought it was required, but please tell me if it is not.
menu: ContextMenuEntry[]; | ||
toolbarItem: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these should be optional.
Also, are submenu and menu undocumented? https://elyra-ai.github.io/canvas/03.03.01-context-menu-handler/#customizing-the-default-context-menu
*/ | ||
deleteLink( | ||
link: string | CanvasLink | Record<string, unknown>, | ||
link: CanvasLink, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In canvas_modules/common-canvas/__tests__/object-model/canvas-controller-api-test.js this is used with only a string, and that worked when I tried it. Is that a deprecated signature?
x_pos?: number; | ||
/** | ||
* y-position of this canvas execution node. | ||
*/ | ||
y_pos?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are x_pos
and y_pos
optional? They appeared to be required, but you can tell me if they are not.
* limitations under the License. | ||
*/ | ||
|
||
declare const messages: Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On testing, I realize this should be Record<string, Record<string, string>>;
* limitations under the License. | ||
*/ | ||
|
||
declare const messages: Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On testing, I realize this should be Record<string, Record<string, string>>;
* limitations under the License. | ||
*/ | ||
|
||
declare const messages: Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On testing, I realize this should be Record<string, Record<string, string>>;
* limitations under the License. | ||
*/ | ||
|
||
declare const messages: Record<string, string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On testing, I realize this should be Record<string, Record<string, string>>;
selectedObjects: Record<string, unknown>[]; | ||
/** @deprecated */ | ||
selectedObjectIds: string[]; | ||
[key: string]: unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on SVGCanvasRenderer.openContextMenu
, it seems like type
, targetObject
, pipelineId
and a few others are included if the editSource
is contextmenu
. Is that a level of detail we should include? Or should we skip that for now? I only bring this up because you used targetObject
in editActionHandler
in canvas_modules/harness/src/client/components/custom-canvases/prompt/prompt-canvas.jsx
Fixes: #1320
Developer's Certificate of Origin 1.1