Commit Graph

3204 Commits

Author SHA1 Message Date
Opender Singh
946deb5ae2
Increase smoke test spectron timeouts (#3440) 2021-06-03 20:43:15 +12:00
Opender Singh
f577020fb9 stop stalebot from closing issues (#3439) 2021-06-03 20:24:53 +12:00
Opender Singh
83f6c2051c Improve modal test util types (#3435) 2021-06-03 20:24:53 +12:00
Eric Reynolds
fa23003de7
Margin control to insomnia-component styled buttons (#3429) 2021-06-02 11:47:23 -04:00
Dimitri Mitropoulos
3ba7b880b6
[o2k] all Kong entities have should tags (#3428) 2021-06-02 08:55:31 -04:00
Opender Singh
36b2462201
Create, rename and delete a local space (#3433) 2021-06-02 13:46:26 +12:00
Opender Singh
d619b8d84e
convert strings to a single object (#3432) 2021-06-01 08:52:41 -04:00
Vincenzo De Petris
6a60e2bbbc
Fix issue chaining multiple requests (#3385)
* Fix issue chaining multiple requests

* refactor: use switch to prepare for leveraging exhaustiveness checking

since this will be in TypeScript soon, and this was as topical a time as any to make this change.

* fixes failing test with new behavior (and removes unused `fromResponseTag`)

* fix tests

Co-authored-by: Vincenzo De Petris <vincenzodepetris@gmail.it>
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-28 08:36:28 +12:00
Dimitri Mitropoulos
ed63c7b458
updates codemirror (in anticipation of upcoming PR bugfix) (#3405)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-28 08:22:27 +12:00
Opender Singh
f18542ffe9
Add Space selector, with the logic to select a space (#3427) 2021-05-28 08:02:16 +12:00
Opender Singh
d7b630f17b
Add formatting ESLint rules (#3425)
* add rules

* run lint:fix

* quick manual fix for lint errors

* indent fix

* add jsx prop multiline

Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
2021-05-27 14:00:32 -04:00
Eric Reynolds
7cb1051634
INS-674 - First pass at making the send button more visible (#3414)
* INS-674 - First pass at making the send button more visible

* [wip] adds rect for send button

* Update colors in the SVG to match send button

* Update the gRPC send button to also use theme colors

* Adding left margin to send button

Co-authored-by: Eric Reynolds <eric.reynolds@konghq.com>
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-27 21:41:25 +12:00
Opender Singh
5753356305
Update stalebot config and add issue management workflow (#3426) 2021-05-27 16:03:22 +12:00
Opender Singh
deda7a37b7
Add space data model (#3424) 2021-05-27 15:59:54 +12:00
Opender Singh
25ac42eb23
Skip apt repo publish if not stable tag (#3423) 2021-05-27 13:00:07 +12:00
Akhil Sasidharan
0b38c68c1f
fix: insomnia open dialog for proto directory can't select directories (#3348)
* fix: insomnia open dialog for proto directory can't select directories

* uses a named export for selectFileOrFolder

(also, removes original js file from rebase)

* clears error by leveraging exhaustiveness check

* fixes bug: the `name` field is actually for a file filter

see the referenced pull request.

As for the `extensions: ['*']`, there's no reason I can see to include a filter and then tell the filter to then accept everything.

* update selectFileOrFolder mocks

* use switch (for exhaustiveness checking) and type selectedFormat

* removes unnecessary filters from _save_ dialog

from the docs:
> The filters specifies an array of file types that can be displayed

As suspected, this is not needed.  A user is free to save it wherever they want.

* adds extension to saved file

not sure why this was missing before, but it appears to have been a bug

* formatting updates

best to "ignore whitespace" for this commit.  I did this with the hope of using the `ThunkAction` type from `redux-thunk`, but once I got them all looking good and started adding the type I quickly learned there's quite a bit more work to do in this area before we can have such a thing.  I therefore opted to just call it a day at that and take the (no-op) formatting changes and typings.

* removes remaining name filters from save dialogs

same reason as the 2nd to prior commit - they cause the bug

Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-26 10:24:21 -04:00
Opender Singh
3c881d5117
disable linting in parallel (#3422) 2021-05-26 12:31:39 +12:00
Dimitri Mitropoulos
2bf4586dc7
[o2k] copy plugin objects as is (and respect enabled flag) (#3419)
* clears all errors in tests, enables overrides for spec generators

* removes copy/pasta in tests, uses spec generator, removes useless async

continuing from the last commit, but separated out for easier review

* consolidates openapi x-kong extension to one place, uses consistently

these were used for some things, not used for others, exported in some places, not exported in others.  now it's uniform and we can look up references for each type.

* adds failing test for ticket

* only adds `enabled` where it was specified

* allows adding passing top-level properties to config

now, the line that was there specifically for `config` is redundant.

* adds tags to test result per review feedback

* removes unnecessary generic

for some reason, this didn't error before, but now it is.

* removes unnecessary argument

this failed on the CI with:

openapi-2-kong: FAIL src/generate.test.ts
openapi-2-kong:   ● Test suite failed to run
openapi-2-kong:     src/generate.test.ts:90:58 - error TS2769: No overload matches this call.
openapi-2-kong:       Overload 1 of 2, '(src: string, options?: (ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined): any', gave the following error.
openapi-2-kong:         Argument of type '"utf8"' is not assignable to parameter of type '(ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined'.
openapi-2-kong:       Overload 2 of 2, '(src: string, reviver: Reviver, options?: (ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined): any', gave the following error.
openapi-2-kong:         Argument of type 'string' is not assignable to parameter of type 'Reviver'.
openapi-2-kong:     90       const parsedSpec = YAML.parse(dcFixtureFileString, 'utf8');
openapi-2-kong:                                                                 ~~~~~~
openapi-2-kong:     src/generate.test.ts💯59 - error TS2769: No overload matches this call.
openapi-2-kong:       Overload 1 of 2, '(src: string, options?: (ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined): any', gave the following error.
openapi-2-kong:         Argument of type '"utf8"' is not assignable to parameter of type '(ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined'.
openapi-2-kong:       Overload 2 of 2, '(src: string, reviver: Reviver, options?: (ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined): any', gave the following error.
openapi-2-kong:         Argument of type 'string' is not assignable to parameter of type 'Reviver'.
openapi-2-kong:     100       const parsedSpec = YAML.parse(k8sFixtureFileString, 'utf8');
2021-05-25 16:05:52 -04:00
Josh Soref
9006babd38
fix spelling (#2976) 2021-05-25 12:16:43 -04:00
Dimitri Mitropoulos
5cd52b2bc9
Fix: o2k optional tags signatures (#3416)
* removes unnecessary plugin indirection

there is no reason to have functions that literally call other functions with the same argument.  well... maybe not _no_ reason, but the one valid reason I can think of (to satisfy an abstraction's constraints) is not met here.  This serves no documentational value either because it creates indirection rather than showing what it's really doing (which is, to generate a plugin).

* reworks generatePlugins and generatePlugin signatures

adds Entry, removes optional `tags`, curries

* use option parameter syntax for generateRequestValidatorPlugin

also, many errors were occurring for OA3Operation.responses not being passed over and over again, leading me to believe it's valid to do so.

* ensures `generateOperationPlugins` has tags, uses option parameter

* removes flowtype comments

* updates readme examples along with readme function signatures

parseSpec and generate were `async` but never awaited

Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-25 08:26:42 -04:00
Opender Singh
2fe35d5314 update lockfile 2021-05-25 19:08:43 +12:00
Opender Singh
88ed96fc47 merge release branch with develop and resolve conflicts 2021-05-25 09:30:09 +12:00
Opender Singh
f2609fcaa9
show both name and uri during import through insomnia protocol (#3407)
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
2021-05-25 09:25:13 +12:00
Eric Reynolds
a248987546
Fix the Purple theme to be the same as it was before single app (#3418)
Co-authored-by: Eric Reynolds <eric.reynolds@konghq.com>
2021-05-24 15:00:45 -04:00
Dimitri Mitropoulos
42341e6e6e
fixes 'previewHidden' of undefined error (#3409)
* readability improvements and reduced indirection

* adds type for handleShowModifyCookieModal

* correctly types wrapperProps property, thereby fixing bug.

if you add `console.log({ previewHidden, propsOne: this.props.wrapperProps.activeWorkspaceMeta });` to the third line of `_renderPreview()` you'll see that `activeWorkspaceMeta` is indeed, sometimes, `undefined.

Also, there's no reason to use `await` on `this.setState`.  I didn't find any more of these in the codebase, I just found this one.

* adds type for swaggerUiSpec

* undoes lifting props to state

almost always, this is done for performance reasons, but I removed it the app is working pretty quick-and-snappy for me without needing to introduced duplicated application state and keep track of it.

I went ahead and measured it before and after this commit (using performance.now):

before = [
  1.93500000750646,
  1.149999996414408,
  0.9499999869149178,
  0.9950000094249845,
  0.8650000090710819,
  1.560000004246831,
  1.5699999930802733,
  0.8450000023003668,
  1.4550000196322799,
  1.3299999991431832,
  1.3050000125076622,
  1.4099999971222132,
  1.3099999923724681,
  1.3100000214762986,
  1.1999999987892807,
  1.0099999781232327,
  0.830000004498288,
  1.2449999921955168,
  1.2500000011641532,
  1.4349999837577343,
]

after = [
  2.9400000057648867,
  2.449999999953434,
  2.33499999740161,
  2.2849999950267375,
  1.7700000025797635,
  1.8149999959859997,
  2.1249999990686774,
  1.9150000007357448,
  2.074999996693805,
  1.9899999897461385,
  2.0200000144541264,
  2.869999996619299,
  2.1450000058393925,
  2.33499999740161,
  2.130000008037314,
  2.119999990100041,
  2.144999976735562,
  2.130000008037314,
  2.380000009201467,
  2.8999999922234565,
]

> R.mean(before)
> 1.2480000004870817

> R.mean(after)
> 2.243749999080319

> R.median(before)
> 1.2775000068359077

> R.median(after)
> 2.137499992386438

So basically, considering a 16ms render rate (i.e. 60hz), 1ms saved by lifting props to state makes no difference in application performance.

This is committed separately so that if there's any reason we want to keep the prior implementation, we can just still do so.
2021-05-24 10:14:00 -04:00
Dimitri Mitropoulos
8fb789f14d
[o2k] fix: kubernetes TLS implementation is (very) wrong (#3410)
* updates Kubernetes types to actually match Kuberenetes Ingress/v1beta1 API

* checks type of result in tests

among other cosmetic changes

* enables strict mode in o2k (but leaves bug it uncovered that this PR fixes)

I really do need this to complete the task at hand.  For example, there was an existing error in `ingressDocWithOverride`:

```
Type 'string | null | undefined' is not assignable to type 'string | undefined'.
  Type 'null' is not assignable to type 'string | undefined'.ts(2322)
kubernetes-config.ts(36, 3): The expected type comes from property 'path' which is declared here on type 'K8sHTTPIngressPath'
```

That is caught only by strict mode.  This is literally what I am fixing in this PR, so it seems like as good a time as any.  Thankfully, only took me ~30 minutes to do because it was already super close.

* fixtures for `kong-for-kubernetes`

* index exporters for actual exports

when I made these files, I didn't understand that the lower-level helpers are not actually exported by the library, therefore there's no reason to have these index.ts files.

Furthermore, the types file could use it's own for the same reason, because those types _are_ actually exported.

* fixes bug: TLS is now an array and a child of K8sIngress.spec

* updates 'yaml'

for some reason I cannot explain, suddenly the CI is failing constantly because of this package.  https://github.com/Kong/insomnia/runs/2639615988

The only `yaml` exports we use in`o2k` are `parse` and `stringify` and we don't re-export it in any way.  Therefore, we should be safe to update it (many other projects in the monorepo are on different versions anyway).  This recent version is written purely in TypeScript, so we don't need the types packages anymore.

* adds a few more docs
2021-05-24 08:23:51 -04:00
Dimitri Mitropoulos
7860be36e3
adds logging for when setting default protocol client fails (#3408)
* adds logging for when setting default protocol client fails

https://www.electronjs.org/docs/api/app#appsetasdefaultprotocolclientprotocol-path-args

* logs `isDefaultProtocolClient` and `getApplicationNameForProtocol`
2021-05-23 22:22:22 -04:00
Opender Singh
be59ef1e3b
GH release workflow improvements (#3406) 2021-05-21 08:43:07 +12:00
Dimitri Mitropoulos
33460a4c44
fixes error code used when build fails (#3402) 2021-05-20 09:50:10 -04:00
Dimitri Mitropoulos
3605bc17cc
Feat/o2k improvements (#3396)
* makes this `yaml` import match all others

for better or for worse, until we upgrade `YAML` (it's now written in TypeScript) we should probably aim for consistency.

* adds overloads so that types of package exports

it would be FAR preferable to use an object with the arguments instead because then we don't have to fall into all the traps that come with overloads, but I am avoiding changing the actual call signature of these function.

* fixes and updates types

* corrects mispelling

* removes shim types and exports actual types from openapi-2-kong

we had everything in place for the rest of the build pipeline to consume these types, but were missing the main exports at the root index.ts file

* use actual openapi-2-kong types now that they're available

* use existing variable for filePath

* extracts o2k-specific helper data to live in o2k

evidently, this data is useful for the usage of o2k, therefore o2k should be the thing exporting it.

* use KubernetesManifest for name of kubernetes manifest union

when first naming this, I didn't have much more context than the property name (documents), so after taking a look,  it's clear that these are kubernetes manifests

* removes attempt at correctly typing overloads

I will return to this, and so I'm leaving it here in a commit rather than squashing it out, but I can't see a way to get it to work without changing the signature in a big way.

* fixes error (now that there are yaml types)

* makes `K8s` vs `Kubernetes` type terminology consistent

part of the motivation for this is that there are significant things in common between the two kinds of configs, making them closer in form is therefore ideal.

* updates mistake in name per review feedback
2021-05-19 22:49:50 -04:00
Opender Singh
9c5742ae73 publish npm packages lib@2.3.0-beta.3 2021-05-20 13:12:04 +12:00
Opender Singh
6b8cf10689 bump to beta.1 2021-05-20 13:05:26 +12:00
Opender Singh
456ff71709 remove --force-publish 2021-05-20 13:03:05 +12:00
Opender Singh
c78f019543 dont lock spectral and bring back prepare script 2021-05-20 12:56:49 +12:00
David Marby
13a45ff621
Fix the ca certs import (#3404) 2021-05-20 10:16:55 +12:00
Dimitri Mitropoulos
fa72e0977b
reverts changes to main.min.js artifact location (#3401) 2021-05-19 15:00:12 -04:00
Dimitri Mitropoulos
a060562697
Fixes clean scripts (#3400)
* removes (unused and unwanted) husky scripts

might as well, it's only taking up space for nothing in our node_modules

* adds `lerna run clean` to main clean script

we didn't have `clean` scripts in the packages before, but now that we do, it makes sense to.... hahah... _use them_.

Note that it's important that we run the package scripts first, because otherwise after the rimraf (which is now at the end) there's no `lerna` left to call.

* adds missing clean script to insomnia-components

although it looks like there are other changes at first glance, there shouldn't be any behavioral differences now except the fact that build will always generate SVGs (which, was an oversight/bug that it wasn't before).  We need this to occur so that when we clean it removes the things that were built, and when we build it replaces those same things.

* adds a postclean script to insomnia-app like every other package

I'll be honest, I'm not entirely sure what the reason is for having `postclean` scripts in every package with (mostly) `rimraf dist` (i.e. instead of just including that in the main clean script at the end), but that's clearly the convention - so for now I'm just following it

* removes references to old build artifact location

well, except for the .gitignore.  I guess I could remove it from the .gitignore, commit it, commit deleting it, which would clear it from everyone's projects... but I'll just leave it there for a bit in the .gitignore.  hopefully people either start fresh or run `clean` from the root every once in a while, which will clean this up.

After a few weeks or months we can remove these two references (in the package.json.clean and .gitignore) altogether if we feel like it.

* removes unused reference in config to build artifact

I searched high and low for every place I could find that consumes this file and none of them seem to use this field anyway.  And even if they did, it's wrong.  In fact, it's been wrong for a while I'd guess because (relative to the root, if that's what it was intended to mean).

As far as I can tell this was added c6a7c4d682 (diff-6918d2464ad7fb0f3e985d8587ce0c4218eeba6c6dea60c58642251f4db99ecb)

So I even checked out that commit and looked at all usages of that file at that time and it was, there too, unused (so far as I can tell).  Appears to be a case of wishful thinking that it'd be useful for something, not sure.
2021-05-19 09:56:10 -04:00
David Marby
34b8c17260 publish npm packages lib@2.3.0-beta.2 2021-05-19 14:50:58 +02:00
David Marby
59498ce28b Add back --force-publish 2021-05-19 14:50:17 +02:00
David Marby
65a53f45fd Fix .npmignore 2021-05-19 14:37:56 +02:00
Dimitri Mitropoulos
860565f3a6
fixes react controlled input error (#3391)
* fix ts-expect-error

* removes useless await

see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md

We're not quite ready to have this rule on everywhere, but in this case I can see that it's correct to follow.

* add comment about magic number

and moves the assignment to the one place it's used

I opted not to make a ticket because we are recently running out of tickets and this seems to be a relatively small thing @reynolek please confirm this is the correct course of action.

* initialize ref to reflect reality (and include actual type)

* fixes root cause of error, inlines one-liners

the error with the type of `_handleInputColorChange` was due to `onChange` being the wrong prop to use (where `onChange` is the one we want).

* use onChange instead of onInput to access correct types

ultimately, since react's behavior diverged from the DOM behavior to match onInput, this should have no effect on any functionality since react assigns this event to `onChange` anyway.  see https://github.com/facebook/react/blob/master/fixtures/attribute-behavior/src/attributes.js#L2089

* clears remaining ts-expect-errors in file

* updates fallback call per review feedback
2021-05-19 08:24:01 -04:00
Opender Singh
5fa8f0069d
Enable ESLint & TS for smoke tests (#3397)
* remove babel and add configs

* add ts-node

* lint scripts

* eslint override

* remove type module

* add expect errors

* update js files to ts

* fix electron import

* remove errors

* update readme

* add build step

* typesync

* add eslintignore
2021-05-19 07:49:48 -04:00
Opender Singh
a3a6c0fdfd
fail if non zero exit code during build (#3399) 2021-05-19 23:41:50 +12:00
Opender Singh
b93d963712 publish npm packages lib@2.3.0-beta.1 2021-05-19 18:51:57 +12:00
Opender Singh
0855462a92 fix insomnia-importers 2021-05-19 18:49:45 +12:00
Roger Guasch
3972bb50ab
Theme preview tile for OS themes (#3387)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-19 18:14:11 +12:00
cobwebsonsale
212ca5d764
Allow switching sub-environment inside Manage Environment modal (#2891)
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-19 17:46:18 +12:00
Opender Singh
ce9637e6e2
Update lerna version message (#3393) 2021-05-19 11:27:09 +12:00
Opender Singh
d713d27578 add missing await in release script 2021-05-19 10:22:03 +12:00
Opender Singh
b2040dacd2 publish npm packages lib@2.3.0-beta.0 2021-05-19 09:21:52 +12:00