u
This commit is contained in:
90
src/providers/mssql/queries/mcp.js
Normal file
90
src/providers/mssql/queries/mcp.js
Normal file
@@ -0,0 +1,90 @@
|
||||
export const INSERT_CLIENT = `
|
||||
INSERT INTO mcp_client (client_id, client_secret, client_name, redirect_uris, grant_types, response_types, scope)
|
||||
OUTPUT INSERTED.id, INSERTED.client_id, INSERTED.client_secret, INSERTED.client_name, INSERTED.redirect_uris, INSERTED.grant_types, INSERTED.response_types, INSERTED.scope, INSERTED.created_at
|
||||
VALUES (@clientId, @clientSecret, @clientName, @redirectUris, @grantTypes, @responseTypes, @scope)
|
||||
`;
|
||||
|
||||
export const GET_CLIENT = `
|
||||
SELECT
|
||||
id,
|
||||
client_id AS clientId,
|
||||
client_secret AS clientSecret,
|
||||
client_name AS clientName,
|
||||
redirect_uris AS redirectUris,
|
||||
grant_types AS grantTypes,
|
||||
response_types AS responseTypes,
|
||||
scope,
|
||||
created_at AS createdAt
|
||||
FROM mcp_client
|
||||
WHERE client_id = @clientId
|
||||
`;
|
||||
|
||||
export const LIST_CLIENTS = `
|
||||
SELECT
|
||||
id,
|
||||
client_id AS clientId,
|
||||
client_name AS clientName,
|
||||
redirect_uris AS redirectUris,
|
||||
grant_types AS grantTypes,
|
||||
response_types AS responseTypes,
|
||||
scope,
|
||||
created_at AS createdAt
|
||||
FROM mcp_client
|
||||
ORDER BY created_at DESC
|
||||
`;
|
||||
|
||||
export const DELETE_CLIENT = `
|
||||
DELETE FROM mcp_client
|
||||
WHERE client_id = @clientId
|
||||
`;
|
||||
|
||||
export const INSERT_AUTH_CODE = `
|
||||
INSERT INTO mcp_auth_code (code, client_id, google_auth_id, redirect_uri, code_challenge, code_challenge_method, scope, expires_at)
|
||||
VALUES (@code, @clientId, @googleAuthId, @redirectUri, @codeChallenge, @codeChallengeMethod, @scope, @expiresAt)
|
||||
`;
|
||||
|
||||
export const GET_AUTH_CODE = `
|
||||
SELECT
|
||||
code,
|
||||
client_id AS clientId,
|
||||
google_auth_id AS googleAuthId,
|
||||
redirect_uri AS redirectUri,
|
||||
code_challenge AS codeChallenge,
|
||||
code_challenge_method AS codeChallengeMethod,
|
||||
scope,
|
||||
expires_at AS expiresAt,
|
||||
used
|
||||
FROM mcp_auth_code
|
||||
WHERE code = @code
|
||||
`;
|
||||
|
||||
export const CONSUME_AUTH_CODE = `
|
||||
UPDATE mcp_auth_code
|
||||
SET used = 1
|
||||
WHERE code = @code
|
||||
`;
|
||||
|
||||
export const INSERT_REFRESH_TOKEN = `
|
||||
INSERT INTO mcp_token (refresh_token, client_id, google_auth_id, scope, expires_at)
|
||||
OUTPUT INSERTED.id
|
||||
VALUES (@refreshToken, @clientId, @googleAuthId, @scope, @expiresAt)
|
||||
`;
|
||||
|
||||
export const GET_REFRESH_TOKEN = `
|
||||
SELECT
|
||||
id,
|
||||
refresh_token AS refreshToken,
|
||||
client_id AS clientId,
|
||||
google_auth_id AS googleAuthId,
|
||||
scope,
|
||||
expires_at AS expiresAt,
|
||||
revoked
|
||||
FROM mcp_token
|
||||
WHERE refresh_token = @refreshToken
|
||||
`;
|
||||
|
||||
export const REVOKE_REFRESH_TOKEN = `
|
||||
UPDATE mcp_token
|
||||
SET revoked = 1
|
||||
WHERE refresh_token = @refreshToken
|
||||
`;
|
||||
Reference in New Issue
Block a user