Skip to content

Commit

Permalink
fix(deps): Update dependency @cloudquery/plugin-pb-javascript to ^0.0…
Browse files Browse the repository at this point in the history
….19 (#177)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@cloudquery/plugin-pb-javascript](https://github.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://github.com/cloudquery/plugin-pb-javascript/blob/HEAD/CHANGELOG.md#0019-2024-06-01)

[Compare Source](https://github.com/cloudquery/plugin-pb-javascript/compare/v0.0.18...v0.0.19)

##### Bug Fixes

-   **deps:** Update dependency [@&#8203;grpc/grpc-js](https://github.com/grpc/grpc-js) to v1.10.7 ([#&#8203;55](https://github.com/cloudquery/plugin-pb-javascript/issues/55)) ([cccda54](https://github.com/cloudquery/plugin-pb-javascript/commit/cccda54173eba4f1868709624dde194909b5f42b))
-   **deps:** Update dependency [@&#8203;grpc/grpc-js](https://github.com/grpc/grpc-js) to v1.10.8 ([#&#8203;58](https://github.com/cloudquery/plugin-pb-javascript/issues/58)) ([18af0d1](https://github.com/cloudquery/plugin-pb-javascript/commit/18af0d14f1473386746afbb3b48708ff0a8f4b56))
-   Generate JavaScript Code from `plugin-pb` ([#&#8203;57](https://github.com/cloudquery/plugin-pb-javascript/issues/57)) ([97268e4](https://github.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://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
  • Loading branch information
cq-bot authored Jun 3, 2024
1 parent aa2c7cb commit a9ec712
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
},
"dependencies": {
"@apache-arrow/esnext-esm": "^12.0.1",
"@cloudquery/plugin-pb-javascript": "^0.0.18",
"@cloudquery/plugin-pb-javascript": "^0.0.19",
"@grpc/grpc-js": "^1.9.0",
"@types/luxon": "^3.3.1",
"ajv": "^8.12.0",
Expand Down
50 changes: 50 additions & 0 deletions src/grpc/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,54 @@ export class PluginServer extends pluginV3.cloudquery.plugin.v3.UnimplementedPlu
return callback(error, null);
});
}

TestConnection(
call: grpc.ServerUnaryCall<
pluginV3.cloudquery.plugin.v3.TestConnection.Request,
pluginV3.cloudquery.plugin.v3.TestConnection.Response
>,
callback: grpc.sendUnaryData<pluginV3.cloudquery.plugin.v3.TestConnection.Response>,
): void {
const { spec = new Uint8Array() } = call.request.toObject();

const stringSpec = new TextDecoder().decode(spec);
if (this.plugin.testConnection) {
this.plugin
.testConnection(stringSpec)
.then(({ success, failureCode, failureDescription }) => {
// eslint-disable-next-line promise/no-callback-in-promise
return callback(
null,
new pluginV3.cloudquery.plugin.v3.TestConnection.Response({
success,
failure_code: failureCode,
failure_description: failureDescription,
}),
);
})
.catch((error) => {
// eslint-disable-next-line promise/no-callback-in-promise
return callback(error, null);
});
} else {
// fall back to init
this.plugin
.init(stringSpec, { noConnection: false })
.then(() => {
// eslint-disable-next-line promise/no-callback-in-promise
return callback(null, new pluginV3.cloudquery.plugin.v3.TestConnection.Response({ success: true }));
})
.catch(() => {
// eslint-disable-next-line promise/no-callback-in-promise
return callback(
null,
new pluginV3.cloudquery.plugin.v3.TestConnection.Response({
success: false,
failure_code: 'UNKNOWN',
failure_description: 'Failed to connect',
}),
);
});
}
}
}
1 change: 1 addition & 0 deletions src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface Plugin extends Client {
dockerFile: () => string;
buildTargets: () => BuildTarget[];
init: (spec: string, options: NewClientOptions) => Promise<void>;
testConnection?: (spec: string) => Promise<{ success?: boolean; failureCode?: string; failureDescription?: string }>;
}

export const newUnimplementedSource = (): SourceClient => {
Expand Down

0 comments on commit a9ec712

Please sign in to comment.