Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 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.14",
"@cloudquery/plugin-pb-javascript": "^0.0.15",
"@grpc/grpc-js": "^1.9.0",
"@types/luxon": "^3.3.1",
"ajv": "^8.12.0",
Expand Down
14 changes: 14 additions & 0 deletions src/grpc/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ export class PluginServer extends pluginV3.cloudquery.plugin.v3.UnimplementedPlu
): void {
return callback(null, new pluginV3.cloudquery.plugin.v3.GetVersion.Response({ version: this.plugin.version() }));
}

GetSpecSchema(
call: grpc.ServerUnaryCall<
pluginV3.cloudquery.plugin.v3.GetSpecSchema.Request,
pluginV3.cloudquery.plugin.v3.GetSpecSchema.Response
>,
callback: grpc.sendUnaryData<pluginV3.cloudquery.plugin.v3.GetSpecSchema.Response>,
): void {
return callback(
null,
new pluginV3.cloudquery.plugin.v3.GetSpecSchema.Response({ json_schema: this.plugin.jsonSchema() }),
);
}

Init(
call: grpc.ServerUnaryCall<pluginV3.cloudquery.plugin.v3.Init.Request, pluginV3.cloudquery.plugin.v3.Init.Response>,
callback: grpc.sendUnaryData<pluginV3.cloudquery.plugin.v3.Init.Response>,
Expand Down
23 changes: 22 additions & 1 deletion src/memdb/memdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,28 @@ export const newMemDBPlugin = (): Plugin => {
return Promise.resolve(pluginClient);
};

const plugin = newPlugin('memdb', '0.0.1', newClient, { team: 'cloudquery', kind: 'source' });
const plugin = newPlugin('memdb', '0.0.1', newClient, {
team: 'cloudquery',
kind: 'source',
jsonSchema: `{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/cloudquery/plugin-sdk-javascript/memdb/spec",
"$ref": "#/$defs/Spec",
"$defs": {
"Spec": {
"properties": {
"concurrency": {
"type": "integer",
"minimum": 1,
"description": "Concurrency."
}
},
"additionalProperties": false,
"type": "object",
},
}
}`,
});
pluginClient.plugin = plugin;
return plugin;
};
3 changes: 3 additions & 0 deletions src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type PluginOptions = {
kind: PluginKind;
dockerFile?: string;
buildTargets?: BuildTarget[];
jsonSchema?: string;
};

export interface SourceClient {
Expand All @@ -65,6 +66,7 @@ export interface Plugin extends Client {
version: () => string;
team: () => string | undefined;
kind: () => PluginKind | undefined;
jsonSchema: () => string | undefined;
dockerFile: () => string;
buildTargets: () => BuildTarget[];
init: (spec: string, options: NewClientOptions) => Promise<void>;
Expand Down Expand Up @@ -102,6 +104,7 @@ export const newPlugin = (
version: () => version,
team: () => options?.team,
kind: () => options?.kind,
jsonSchema: () => options?.jsonSchema,
dockerFile: () => options?.dockerFile || 'Dockerfile',
buildTargets: () => options?.buildTargets || defaultBuildTargets,
write: (stream: WriteStream) => {
Expand Down