Skip to content

Enable new storage integrations via wizard - #12733

Merged
JakeUskoski merged 3 commits into
mainfrom
jakeuskoski/enable-new-storage-integrations-via-wizard
Dec 11, 2024
Merged

JakeUskoski merged 3 commits into
mainfrom
jakeuskoski/enable-new-storage-integrations-via-wizard

Conversation

@JakeUskoski

Copy link
Copy Markdown

We moved from using a type field to a protocols object with some additional information for determining the category of an integration. New storage products don't have the old type field, instead using the new protocols, but are otherwise still storage products with the same wizard setup needs. New integrations that would otherwise be fine to use the wizard for setup were directing users to the dashboard to complete the installation process (undesired behaviour).

This PR adds in the typing for the protocols currently in use (as of this PR, just storage), so that our newest integration products can be added purely via the CLI.

@changeset-bot

changeset-bot Bot commented Dec 11, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df64e2c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 47 to 57
export interface IntegrationProduct {
id: string;
slug: string;
name: string;
shortDescription: string;
type: 'storage' | string;
type?: 'storage' | string;
protocols?: {
storage?: StorageIntegrationProtocol;
};
metadataSchema: MetadataSchema;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): ‏use union types for stronger type checking

When the overall true type varies when the value of a property, I like to use a union type for stronger type checking. This will prevent the case where both storage and protocols are missing or both are populated.

Example:

type IntegrationProductBase = {
  id: string;
  slug: string;
  name: string;
  shortDescription: string;
  metadataSchema: MetadataSchema;
}
type OldIntegrationProduct = IntegrationProductBase & {
  // `type` no longer optional
  type: 'storage' | string;
}

type NewIntegrationProduct = IntegrationProductBase & {
  // `protocols` no longer optional
  protocols: {
    storage?: StorageIntegrationProtocol;
  };
}

type IntegrationProduct = OldIntegrationProduct | NewIntegrationProduct;

let a: IntegrationProduct = {
  id: 'a',
  slug: 'product-a',
  name: 'Product A',
  shortDescription: 'product called "a"',
  metadataSchema: {},

  type: 'storage',
  
}

let b: IntegrationProduct = {
  id: 'b',
  slug: 'product-b',
  name: 'Product B',
  shortDescription: 'product called "B"',
  metadataSchema: {},

  protocols: {
    storage: {}
  },
}

@JakeUskoski JakeUskoski Dec 11, 2024 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our world, both fields can exist, so it's less a "one or the other" case. We've introduced this new concept of protocols, which the old integrations also use, and the protocols just-so-happen to do what "type" did as well, but better (product being multiple categories and categories having some bespoke concepts). Eventually we'll deprecate the type field and remove it entirely, but for now we have integrations where both values exist.

I'll keep this in mind for future situations, though. I like stronger types like this a lot 🙂

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, my reading from the PR description was that they were exclusive.

Do the values need to exist in responses from the API? If not, you could restrict those values at the API serialization layer such that types like this suggestion could be used in clients.

@JakeUskoski
JakeUskoski added this pull request to the merge queue Dec 11, 2024
@EndangeredMassa
EndangeredMassa removed this pull request from the merge queue due to a manual request Dec 11, 2024
@EndangeredMassa

Copy link
Copy Markdown
Contributor

I removed this from the queue to give you a chance to review my feedback before merging. I did approve this PR--so you can still merge if you like.

@JakeUskoski
JakeUskoski added this pull request to the merge queue Dec 11, 2024
Merged via the queue into main with commit d7fa27a Dec 11, 2024
@JakeUskoski
JakeUskoski deleted the jakeuskoski/enable-new-storage-integrations-via-wizard branch December 11, 2024 18:47
EndangeredMassa pushed a commit that referenced this pull request Dec 12, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @vercel/[email protected]

### Major Changes

- update path-to-regexp
([#12734](#12734))

### Patch Changes

- Updated dependencies
\[[`7c3114ff8a1bdf0933c008a83e46c3d8f6dfcf7d`](7c3114f)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Major Changes

- Bump path-to-regexp from 6.2.1 to 6.3.0
([#12744](#12744))

## @vercel/[email protected]

### Major Changes

- update path-to-regexp
([#12734](#12734))

## @vercel/[email protected]

### Minor Changes

- Add bun detection using bun.lock
([#12740](#12740))

## @vercel/[email protected]

### Minor Changes

- Add bun detection using bun.lock
([#12740](#12740))

### Patch Changes

- Updated dependencies
\[[`0c4ce9cfbf0c6d3108656584d56fa501e3efe15e`](0c4ce9c)]:
    -   @vercel/[email protected]

## [email protected]

### Patch Changes

- Fix hanging command when `spawn()` fails during CLI extension
invocation ([#12735](#12735))

- Update to v2 endpoints for fetching integrations and installations
([#12721](#12721))

- Bug fix: new integrations using protocols for storage category can be
created via the CLI wizard
([#12733](#12733))

- [cli] expand cache boundary
([#12726](#12726))

- bump cookie and sentry/node
([#12739](#12739))

- Updated dependencies
\[[`7c3114ff8a1bdf0933c008a83e46c3d8f6dfcf7d`](7c3114f),
[`0c4ce9cfbf0c6d3108656584d56fa501e3efe15e`](0c4ce9c),
[`bcb9fbe059a017cf78ed2d7b15991d704beb4cf8`](bcb9fbe)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`7c3114ff8a1bdf0933c008a83e46c3d8f6dfcf7d`](7c3114f),
[`0c4ce9cfbf0c6d3108656584d56fa501e3efe15e`](0c4ce9c)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`7c3114ff8a1bdf0933c008a83e46c3d8f6dfcf7d`](7c3114f),
[`0c4ce9cfbf0c6d3108656584d56fa501e3efe15e`](0c4ce9c)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`0c4ce9cfbf0c6d3108656584d56fa501e3efe15e`](0c4ce9c)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/[email protected]

## @vercel-internals/[email protected]

### Patch Changes

- Updated dependencies
\[[`7c3114ff8a1bdf0933c008a83e46c3d8f6dfcf7d`](7c3114f),
[`0c4ce9cfbf0c6d3108656584d56fa501e3efe15e`](0c4ce9c)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
QuietCraftsmanship pushed a commit to QuietCraftsmanship/Vercel that referenced this pull request Jul 6, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @vercel/[email protected]

### Major Changes

- update path-to-regexp
([#12734](vercel/vercel#12734))

### Patch Changes

- Updated dependencies
\[[`39d6c77457c7edd67455a17f336deb5d2bd7046d`](vercel/vercel@39d6c77)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Major Changes

- Bump path-to-regexp from 6.2.1 to 6.3.0
([#12744](vercel/vercel#12744))

## @vercel/[email protected]

### Major Changes

- update path-to-regexp
([#12734](vercel/vercel#12734))

## @vercel/[email protected]

### Minor Changes

- Add bun detection using bun.lock
([#12740](vercel/vercel#12740))

## @vercel/[email protected]

### Minor Changes

- Add bun detection using bun.lock
([#12740](vercel/vercel#12740))

### Patch Changes

- Updated dependencies
\[[`3c51cb9da3f14475c9bd755c0a471323b541960c`](vercel/vercel@3c51cb9)]:
    -   @vercel/[email protected]

## [email protected]

### Patch Changes

- Fix hanging command when `spawn()` fails during CLI extension
invocation ([#12735](vercel/vercel#12735))

- Update to v2 endpoints for fetching integrations and installations
([#12721](vercel/vercel#12721))

- Bug fix: new integrations using protocols for storage category can be
created via the CLI wizard
([#12733](vercel/vercel#12733))

- [cli] expand cache boundary
([#12726](vercel/vercel#12726))

- bump cookie and sentry/node
([#12739](vercel/vercel#12739))

- Updated dependencies
\[[`39d6c77457c7edd67455a17f336deb5d2bd7046d`](vercel/vercel@39d6c77),
[`3c51cb9da3f14475c9bd755c0a471323b541960c`](vercel/vercel@3c51cb9),
[`bc6b111018bd881267dc3db069908ec10afaedb5`](vercel/vercel@bc6b111)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`39d6c77457c7edd67455a17f336deb5d2bd7046d`](vercel/vercel@39d6c77),
[`3c51cb9da3f14475c9bd755c0a471323b541960c`](vercel/vercel@3c51cb9)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`39d6c77457c7edd67455a17f336deb5d2bd7046d`](vercel/vercel@39d6c77),
[`3c51cb9da3f14475c9bd755c0a471323b541960c`](vercel/vercel@3c51cb9)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`3c51cb9da3f14475c9bd755c0a471323b541960c`](vercel/vercel@3c51cb9)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/[email protected]

## @vercel-internals/[email protected]

### Patch Changes

- Updated dependencies
\[[`39d6c77457c7edd67455a17f336deb5d2bd7046d`](vercel/vercel@39d6c77),
[`3c51cb9da3f14475c9bd755c0a471323b541960c`](vercel/vercel@3c51cb9)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — df64e2ce Deployed Dec 11, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants