Skip to content

Commit

Permalink
Revert "Retrieve and refresh integration insight on demand (#499)" (#511
Browse files Browse the repository at this point in the history
)

This reverts commit 40a884a.
  • Loading branch information
etsai-stripe authored Jan 19, 2022
1 parent 40a884a commit b4bbee2
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 538 deletions.
12 changes: 7 additions & 5 deletions src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as grpc from '@grpc/grpc-js';
import * as querystring from 'querystring';
import * as vscode from 'vscode';
import {
Expand Down Expand Up @@ -352,10 +351,9 @@ export class Commands {

openLogDetails = (data: any) => {
this.telemetry.sendEvent('openLogDetails');
const {id, provider} = data;
const {id} = data;
const filename = id;
const uri = vscode.Uri.parse(`stripeLog:${filename}`);
provider.refresh(uri);
vscode.workspace
.openTextDocument(uri)
.then((doc) => vscode.languages.setTextDocumentLanguage(doc, 'json'))
Expand Down Expand Up @@ -418,7 +416,9 @@ export class Commands {
fixtureRequest.setEvent(eventName);
daemonClient.fixture(fixtureRequest, (error, response) => {
if (error) {
if (error.code === grpc.status.UNIMPLEMENTED) {
if (error.code === 12) {
// https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// 12: UNIMPLEMENTED
vscode.window.showErrorMessage(
'Please upgrade your Stripe CLI to the latest version to use this feature.',
);
Expand Down Expand Up @@ -494,7 +494,9 @@ export class Commands {

daemonClient.trigger(triggerRequest, (error, response) => {
if (error) {
if (error.code === grpc.status.UNIMPLEMENTED) {
if (error.code === 12) {
// https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// 12: UNIMPLEMENTED
vscode.window.showErrorMessage(
'Please upgrade your Stripe CLI to the latest version to use this feature.',
);
Expand Down
36 changes: 17 additions & 19 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {SurveyPrompt} from './surveyPrompt';
import {TelemetryPrompt} from './telemetryPrompt';
import path from 'path';

export async function activate(this: any, context: ExtensionContext) {
export function activate(this: any, context: ExtensionContext) {
initializeStripeWorkspaceState(context);

new TelemetryPrompt(context).activate();
Expand All @@ -52,23 +52,6 @@ export async function activate(this: any, context: ExtensionContext) {
const stripeClient = new StripeClient(telemetry, context);
const stripeDaemon = new StripeDaemon(stripeClient);
const stripeSamples = new StripeSamples(stripeClient, stripeDaemon);
const daemonClient = await stripeDaemon.setupClient();

workspace.registerTextDocumentContentProvider(
'stripeEvent',
new StripeResourceDocumentContentProvider(context, EVENT_ID_REGEXP, retrieveEventDetails, undefined, undefined, false),
);

const logContentProvider = new StripeResourceDocumentContentProvider(context, LOG_ID_REGEXP, undefined, retrieveLogDetails, daemonClient, true);
workspace.registerTextDocumentContentProvider(
'stripeLog',
logContentProvider,
);

languages.registerDocumentLinkProvider(
{scheme: 'stripeLog'},
new StripeLogsDashboardLinkProvider(),
);

const stripeEventsViewProvider = new StripeEventsViewProvider(
stripeClient,
Expand All @@ -80,7 +63,7 @@ export async function activate(this: any, context: ExtensionContext) {
showCollapseAll: true,
});

const stripeLogsViewProvider = new StripeLogsViewProvider(stripeClient, stripeDaemon, context, logContentProvider);
const stripeLogsViewProvider = new StripeLogsViewProvider(stripeClient, stripeDaemon, context);
window.createTreeView('stripeLogsView', {
treeDataProvider: stripeLogsViewProvider,
showCollapseAll: true,
Expand Down Expand Up @@ -111,6 +94,21 @@ export async function activate(this: any, context: ExtensionContext) {

debug.registerDebugConfigurationProvider('stripe', new StripeDebugProvider(telemetry));

workspace.registerTextDocumentContentProvider(
'stripeEvent',
new StripeResourceDocumentContentProvider(context, EVENT_ID_REGEXP, retrieveEventDetails),
);

workspace.registerTextDocumentContentProvider(
'stripeLog',
new StripeResourceDocumentContentProvider(context, LOG_ID_REGEXP, retrieveLogDetails),
);

languages.registerDocumentLinkProvider(
{scheme: 'stripeLog'},
new StripeLogsDashboardLinkProvider(),
);

const git = new Git();
new StripeLinter(telemetry, git).activate();

Expand Down
6 changes: 0 additions & 6 deletions src/rpc/commands_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import * as commands_pb from "./commands_pb";
import * as events_resend_pb from "./events_resend_pb";
import * as fixtures_pb from "./fixtures_pb";
import * as integration_insights_pb from "./integration_insights_pb";
import * as listen_pb from "./listen_pb";
import * as login_pb from "./login_pb";
import * as login_status_pb from "./login_status_pb";
Expand All @@ -23,7 +22,6 @@ import * as grpc from "@grpc/grpc-js";
interface IStripeCLIService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
eventsResend: grpc.MethodDefinition<events_resend_pb.EventsResendRequest, events_resend_pb.EventsResendResponse>;
fixture: grpc.MethodDefinition<fixtures_pb.FixtureRequest, fixtures_pb.FixtureResponse>;
integrationInsight: grpc.MethodDefinition<integration_insights_pb.IntegrationInsightRequest, integration_insights_pb.IntegrationInsightResponse>;
listen: grpc.MethodDefinition<listen_pb.ListenRequest, listen_pb.ListenResponse>;
login: grpc.MethodDefinition<login_pb.LoginRequest, login_pb.LoginResponse>;
loginStatus: grpc.MethodDefinition<login_status_pb.LoginStatusRequest, login_status_pb.LoginStatusResponse>;
Expand All @@ -42,7 +40,6 @@ export const StripeCLIService: IStripeCLIService;
export interface IStripeCLIServer extends grpc.UntypedServiceImplementation {
eventsResend: grpc.handleUnaryCall<events_resend_pb.EventsResendRequest, events_resend_pb.EventsResendResponse>;
fixture: grpc.handleUnaryCall<fixtures_pb.FixtureRequest, fixtures_pb.FixtureResponse>;
integrationInsight: grpc.handleUnaryCall<integration_insights_pb.IntegrationInsightRequest, integration_insights_pb.IntegrationInsightResponse>;
listen: grpc.handleServerStreamingCall<listen_pb.ListenRequest, listen_pb.ListenResponse>;
login: grpc.handleUnaryCall<login_pb.LoginRequest, login_pb.LoginResponse>;
loginStatus: grpc.handleUnaryCall<login_status_pb.LoginStatusRequest, login_status_pb.LoginStatusResponse>;
Expand All @@ -64,9 +61,6 @@ export class StripeCLIClient extends grpc.Client {
fixture(argument: fixtures_pb.FixtureRequest, callback: grpc.requestCallback<fixtures_pb.FixtureResponse>): grpc.ClientUnaryCall;
fixture(argument: fixtures_pb.FixtureRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<fixtures_pb.FixtureResponse>): grpc.ClientUnaryCall;
fixture(argument: fixtures_pb.FixtureRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<fixtures_pb.FixtureResponse>): grpc.ClientUnaryCall;
integrationInsight(argument: integration_insights_pb.IntegrationInsightRequest, callback: grpc.requestCallback<integration_insights_pb.IntegrationInsightResponse>): grpc.ClientUnaryCall;
integrationInsight(argument: integration_insights_pb.IntegrationInsightRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<integration_insights_pb.IntegrationInsightResponse>): grpc.ClientUnaryCall;
integrationInsight(argument: integration_insights_pb.IntegrationInsightRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<integration_insights_pb.IntegrationInsightResponse>): grpc.ClientUnaryCall;
listen(argument: listen_pb.ListenRequest, metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientReadableStream<listen_pb.ListenResponse>;
listen(argument: listen_pb.ListenRequest, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream<listen_pb.ListenResponse>;
login(argument: login_pb.LoginRequest, callback: grpc.requestCallback<login_pb.LoginResponse>): grpc.ClientUnaryCall;
Expand Down
35 changes: 0 additions & 35 deletions src/rpc/commands_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
var grpc = require('@grpc/grpc-js');
var events_resend_pb = require('./events_resend_pb.js');
var fixtures_pb = require('./fixtures_pb.js');
var integration_insights_pb = require('./integration_insights_pb.js');
var listen_pb = require('./listen_pb.js');
var login_pb = require('./login_pb.js');
var login_status_pb = require('./login_status_pb.js');
Expand Down Expand Up @@ -61,28 +60,6 @@ function deserialize_rpc_FixtureResponse(buffer_arg) {
return fixtures_pb.FixtureResponse.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_rpc_IntegrationInsightRequest(arg) {
if (!(arg instanceof integration_insights_pb.IntegrationInsightRequest)) {
throw new Error('Expected argument of type rpc.IntegrationInsightRequest');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_rpc_IntegrationInsightRequest(buffer_arg) {
return integration_insights_pb.IntegrationInsightRequest.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_rpc_IntegrationInsightResponse(arg) {
if (!(arg instanceof integration_insights_pb.IntegrationInsightResponse)) {
throw new Error('Expected argument of type rpc.IntegrationInsightResponse');
}
return Buffer.from(arg.serializeBinary());
}

function deserialize_rpc_IntegrationInsightResponse(buffer_arg) {
return integration_insights_pb.IntegrationInsightResponse.deserializeBinary(new Uint8Array(buffer_arg));
}

function serialize_rpc_ListenRequest(arg) {
if (!(arg instanceof listen_pb.ListenRequest)) {
throw new Error('Expected argument of type rpc.ListenRequest');
Expand Down Expand Up @@ -351,18 +328,6 @@ fixture: {
responseSerialize: serialize_rpc_FixtureResponse,
responseDeserialize: deserialize_rpc_FixtureResponse,
},
// Retrieve the integration insight of given log.
integrationInsight: {
path: '/rpc.StripeCLI/IntegrationInsight',
requestStream: false,
responseStream: false,
requestType: integration_insights_pb.IntegrationInsightRequest,
responseType: integration_insights_pb.IntegrationInsightResponse,
requestSerialize: serialize_rpc_IntegrationInsightRequest,
requestDeserialize: deserialize_rpc_IntegrationInsightRequest,
responseSerialize: serialize_rpc_IntegrationInsightResponse,
responseDeserialize: deserialize_rpc_IntegrationInsightResponse,
},
// Receive webhook events from the Stripe API to your local machine. Like `stripe listen`.
listen: {
path: '/rpc.StripeCLI/Listen',
Expand Down
1 change: 0 additions & 1 deletion src/rpc/commands_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import * as jspb from "google-protobuf";
import * as events_resend_pb from "./events_resend_pb";
import * as fixtures_pb from "./fixtures_pb";
import * as integration_insights_pb from "./integration_insights_pb";
import * as listen_pb from "./listen_pb";
import * as login_pb from "./login_pb";
import * as login_status_pb from "./login_status_pb";
Expand Down
2 changes: 0 additions & 2 deletions src/rpc/commands_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ var events_resend_pb = require('./events_resend_pb.js');
goog.object.extend(proto, events_resend_pb);
var fixtures_pb = require('./fixtures_pb.js');
goog.object.extend(proto, fixtures_pb);
var integration_insights_pb = require('./integration_insights_pb.js');
goog.object.extend(proto, integration_insights_pb);
var listen_pb = require('./listen_pb.js');
goog.object.extend(proto, listen_pb);
var login_pb = require('./login_pb.js');
Expand Down
1 change: 0 additions & 1 deletion src/rpc/integration_insights_grpc_pb.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/rpc/integration_insights_grpc_pb.js

This file was deleted.

45 changes: 0 additions & 45 deletions src/rpc/integration_insights_pb.d.ts

This file was deleted.

Loading

0 comments on commit b4bbee2

Please sign in to comment.