Skip to content

Commit d7fa27a

Browse files
authored
Enable new storage integrations via wizard (#12733)
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.
1 parent 141c244 commit d7fa27a

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Diff for: .changeset/plenty-phones-happen.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vercel": patch
3+
---
4+
5+
Bug fix: new integrations using protocols for storage category can be created via the CLI wizard

Diff for: packages/cli/src/commands/integration/add.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ export async function add(client: Client, args: string[]) {
117117
// At the time of writing, we don't support native integrations besides storage products.
118118
// However, when we introduce new categories, we avoid breaking this version of the CLI by linking all
119119
// non-storage categories to the dashboard.
120-
const isStorageProduct = product.type === 'storage';
120+
// product.type is the old way of defining categories, while the protocols are the new way.
121+
const isPreProtocolStorageProduct = product.type === 'storage';
122+
const isPostProtocolStorageProduct =
123+
product.protocols?.storage?.status === 'enabled';
124+
const isStorageProduct =
125+
isPreProtocolStorageProduct || isPostProtocolStorageProduct;
121126

122127
// The provisioning via cli is possible when
123128
// 1. The integration was installed once (terms have been accepted)

Diff for: packages/cli/src/util/integration/types.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,27 @@ export interface MetadataSchema {
3232
required?: string[];
3333
}
3434

35+
export type IntegrationProductProtocolBase = {
36+
status: 'enabled' | 'disabled';
37+
};
38+
39+
export type StorageIntegrationProtocol = IntegrationProductProtocolBase & {
40+
repl?: {
41+
enabled: boolean;
42+
supportsReadOnlyMode: boolean;
43+
welcomeMessage?: string;
44+
};
45+
};
46+
3547
export interface IntegrationProduct {
3648
id: string;
3749
slug: string;
3850
name: string;
3951
shortDescription: string;
40-
type: 'storage' | string;
52+
type?: 'storage' | string;
53+
protocols?: {
54+
storage?: StorageIntegrationProtocol;
55+
};
4156
metadataSchema: MetadataSchema;
4257
}
4358

0 commit comments

Comments
 (0)