Skip to content

Commit a9ec712

Browse files
authored
fix(deps): Update dependency @cloudquery/plugin-pb-javascript to ^0.0.19 (#177)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@cloudquery/plugin-pb-javascript](https://togithub.com/cloudquery/plugin-pb-javascript) | dependencies | patch | [`^0.0.18` -> `^0.0.19`](https://renovatebot.com/diffs/npm/@cloudquery%2fplugin-pb-javascript/0.0.18/0.0.19) | --- ### Release Notes <details> <summary>cloudquery/plugin-pb-javascript (@&#8203;cloudquery/plugin-pb-javascript)</summary> ### [`v0.0.19`](https://togithub.com/cloudquery/plugin-pb-javascript/blob/HEAD/CHANGELOG.md#0019-2024-06-01) [Compare Source](https://togithub.com/cloudquery/plugin-pb-javascript/compare/v0.0.18...v0.0.19) ##### Bug Fixes - **deps:** Update dependency [@&#8203;grpc/grpc-js](https://togithub.com/grpc/grpc-js) to v1.10.7 ([#&#8203;55](https://togithub.com/cloudquery/plugin-pb-javascript/issues/55)) ([cccda54](https://togithub.com/cloudquery/plugin-pb-javascript/commit/cccda54173eba4f1868709624dde194909b5f42b)) - **deps:** Update dependency [@&#8203;grpc/grpc-js](https://togithub.com/grpc/grpc-js) to v1.10.8 ([#&#8203;58](https://togithub.com/cloudquery/plugin-pb-javascript/issues/58)) ([18af0d1](https://togithub.com/cloudquery/plugin-pb-javascript/commit/18af0d14f1473386746afbb3b48708ff0a8f4b56)) - Generate JavaScript Code from `plugin-pb` ([#&#8203;57](https://togithub.com/cloudquery/plugin-pb-javascript/issues/57)) ([97268e4](https://togithub.com/cloudquery/plugin-pb-javascript/commit/97268e41a029ea14e64e59357d33b4b350c699c1)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
1 parent aa2c7cb commit a9ec712

File tree

4 files changed

+57
-5
lines changed

4 files changed

+57
-5
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
},
8989
"dependencies": {
9090
"@apache-arrow/esnext-esm": "^12.0.1",
91-
"@cloudquery/plugin-pb-javascript": "^0.0.18",
91+
"@cloudquery/plugin-pb-javascript": "^0.0.19",
9292
"@grpc/grpc-js": "^1.9.0",
9393
"@types/luxon": "^3.3.1",
9494
"ajv": "^8.12.0",

src/grpc/plugin.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,54 @@ export class PluginServer extends pluginV3.cloudquery.plugin.v3.UnimplementedPlu
158158
return callback(error, null);
159159
});
160160
}
161+
162+
TestConnection(
163+
call: grpc.ServerUnaryCall<
164+
pluginV3.cloudquery.plugin.v3.TestConnection.Request,
165+
pluginV3.cloudquery.plugin.v3.TestConnection.Response
166+
>,
167+
callback: grpc.sendUnaryData<pluginV3.cloudquery.plugin.v3.TestConnection.Response>,
168+
): void {
169+
const { spec = new Uint8Array() } = call.request.toObject();
170+
171+
const stringSpec = new TextDecoder().decode(spec);
172+
if (this.plugin.testConnection) {
173+
this.plugin
174+
.testConnection(stringSpec)
175+
.then(({ success, failureCode, failureDescription }) => {
176+
// eslint-disable-next-line promise/no-callback-in-promise
177+
return callback(
178+
null,
179+
new pluginV3.cloudquery.plugin.v3.TestConnection.Response({
180+
success,
181+
failure_code: failureCode,
182+
failure_description: failureDescription,
183+
}),
184+
);
185+
})
186+
.catch((error) => {
187+
// eslint-disable-next-line promise/no-callback-in-promise
188+
return callback(error, null);
189+
});
190+
} else {
191+
// fall back to init
192+
this.plugin
193+
.init(stringSpec, { noConnection: false })
194+
.then(() => {
195+
// eslint-disable-next-line promise/no-callback-in-promise
196+
return callback(null, new pluginV3.cloudquery.plugin.v3.TestConnection.Response({ success: true }));
197+
})
198+
.catch(() => {
199+
// eslint-disable-next-line promise/no-callback-in-promise
200+
return callback(
201+
null,
202+
new pluginV3.cloudquery.plugin.v3.TestConnection.Response({
203+
success: false,
204+
failure_code: 'UNKNOWN',
205+
failure_description: 'Failed to connect',
206+
}),
207+
);
208+
});
209+
}
210+
}
161211
}

src/plugin/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export interface Plugin extends Client {
7070
dockerFile: () => string;
7171
buildTargets: () => BuildTarget[];
7272
init: (spec: string, options: NewClientOptions) => Promise<void>;
73+
testConnection?: (spec: string) => Promise<{ success?: boolean; failureCode?: string; failureDescription?: string }>;
7374
}
7475

7576
export const newUnimplementedSource = (): SourceClient => {

0 commit comments

Comments
 (0)