Skip to content

Commit

Permalink
Merge pull request #154 from near/main
Browse files Browse the repository at this point in the history
Prod release 28/07/23
  • Loading branch information
morgsmccauley authored Jul 28, 2023
2 parents dd69196 + 814dff8 commit d354599
Show file tree
Hide file tree
Showing 16 changed files with 920 additions and 281 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/deploy-lambdas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
HASURA_ENDPOINT: ${{ vars.HASURA_ENDPOINT }}
HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }}
PG_ADMIN_USER: ${{ secrets.PG_ADMIN_USER }}
PG_ADMIN_PASSWORD: ${{ secrets.PG_ADMIN_PASSWORD }}
PG_ADMIN_DATABASE: ${{ secrets.PG_ADMIN_DATABASE }}
PG_HOST: ${{ secrets.PG_HOST }}
PG_PORT: ${{ secrets.PG_PORT }}
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,14 @@ return (
{blockHeight !== "now" && (
<Actions>
<Widget
src={`${APP_OWNER}/widget/QueryApi.Examples.Feed.LikeButton`}
src={`mob.near/widget/LikeButton`}
props={{
item: {
type: "social",
path: `${accountId}/post/comment`,
blockHeight,
},
notifyAccountId: state.notifyAccountId,
likes: [],
GRAPHQL_ENDPOINT,
APP_OWNER,
}}
/>
<Widget
Expand Down
112 changes: 82 additions & 30 deletions indexer-js-queue-handler/__snapshots__/hasura-client.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HasuraClient adds a datasource 1`] = `
{
"args": {
"configuration": {
"connection_info": {
"database_url": {
"connection_parameters": {
"database": "morgs_near",
"host": "localhost",
"password": "password",
"port": 5432,
"username": "morgs_near",
},
},
},
},
"name": "morgs_near",
},
"type": "pg_add_source",
}
`;

exports[`HasuraClient adds the specified permissions for the specified roles/table/schema 1`] = `
{
"args": [
Expand Down Expand Up @@ -146,51 +168,66 @@ exports[`HasuraClient adds the specified permissions for the specified roles/tab
}
`;

exports[`HasuraClient checks if a schema exists 1`] = `
exports[`HasuraClient checks if a schema exists within source 1`] = `
[
[
"mock-hasura-endpoint/v2/query",
{
"body": "{"type":"run_sql","args":{"sql":"SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'schema'","read_only":true,"source":"source"}}",
"headers": {
"X-Hasura-Admin-Secret": "mock-hasura-admin-secret",
},
"method": "POST",
},
],
]
`;

exports[`HasuraClient checks if datasource exists 1`] = `
{
"args": {
"read_only": true,
"source": "default",
"sql": "SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'name'",
},
"type": "run_sql",
"args": {},
"type": "export_metadata",
"version": 2,
}
`;

exports[`HasuraClient creates a schema 1`] = `
{
"args": {
"read_only": false,
"source": "default",
"sql": "CREATE schema name",
},
"type": "run_sql",
}
[
[
"mock-hasura-endpoint/v2/query",
{
"body": "{"type":"run_sql","args":{"sql":"CREATE schema schemaName","read_only":false,"source":"dbName"}}",
"headers": {
"X-Hasura-Admin-Secret": "mock-hasura-admin-secret",
},
"method": "POST",
},
],
]
`;

exports[`HasuraClient gets table names within a schema 1`] = `
{
"args": {
"read_only": true,
"source": "default",
"sql": "SELECT table_name FROM information_schema.tables WHERE table_schema = 'schema'",
"source": "source",
},
"type": "run_sql",
"type": "pg_get_source_tables",
}
`;

exports[`HasuraClient runs migrations for the specified schema 1`] = `
{
"args": {
"read_only": false,
"source": "default",
"sql": "
set schema 'schema';
CREATE TABLE blocks (height numeric)
",
},
"type": "run_sql",
}
[
[
"mock-hasura-endpoint/v2/query",
{
"body": "{"type":"run_sql","args":{"sql":"\\n set schema 'schemaName';\\n CREATE TABLE blocks (height numeric)\\n ","read_only":false,"source":"dbName"}}",
"headers": {
"X-Hasura-Admin-Secret": "mock-hasura-admin-secret",
},
"method": "POST",
},
],
]
`;

exports[`HasuraClient tracks foreign key relationships 1`] = `
Expand Down Expand Up @@ -346,3 +383,18 @@ exports[`HasuraClient tracks the specified tables for a specified schema 1`] = `
"type": "bulk",
}
`;

exports[`HasuraClient untracks the specified tables 1`] = `
[
[
"mock-hasura-endpoint/v1/metadata",
{
"body": "{"type":"bulk","args":[{"type":"pg_untrack_table","args":{"table":{"schema":"schema","name":"height"},"source":"default","cascade":true}},{"type":"pg_untrack_table","args":{"table":{"schema":"schema","name":"width"},"source":"default","cascade":true}}]}",
"headers": {
"X-Hasura-Admin-Secret": "mock-hasura-admin-secret",
},
"method": "POST",
},
],
]
`;
18 changes: 18 additions & 0 deletions indexer-js-queue-handler/__snapshots__/provisioner.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Provisioner provisionUserApi formats user input before executing the query 1`] = `
[
[
"CREATE DATABASE "databaseName UNION SELECT * FROM users --"",
],
[
"CREATE USER morgs_near WITH PASSWORD 'pass; DROP TABLE users;--'",
],
[
"GRANT ALL PRIVILEGES ON DATABASE "databaseName UNION SELECT * FROM users --" TO morgs_near",
],
[
"REVOKE CONNECT ON DATABASE "databaseName UNION SELECT * FROM users --" FROM PUBLIC",
],
]
`;
Loading

0 comments on commit d354599

Please sign in to comment.