Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Persisted-queryをやってみた
Search
indigolain
August 28, 2020
Technology
1.4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Persisted-queryをやってみた
GraphQL Tokyo #10 発表資料
indigolain
August 28, 2020
More Decks by indigolain
See All by indigolain
スタディサプリにおける TypeScript 活用事例と今後の展望 / jsconf-jp-2021
indigolain
3
6.2k
フロントエンドチーム立ち上げで学んだTips / What I learned from organizing the new frontend team
indigolain
0
2.8k
TEC DEPT 201610 Catal Engineer5期生募集
indigolain
0
500
なるほどUNIXプロセス14_15章
indigolain
0
180
なるほどUNIXプロセス10~11章
indigolain
0
160
なるほどUNIXプロセス4~5章
indigolain
0
190
Other Decks in Technology
See All in Technology
20分でわかるセキュアAPI
nwiizo
2
320
案件に一番詳しいAIを Amazon Bedrock AgentCore で作る ― 知見が知見を生むチームへ / Compounding Knowledge with AgentCore
yusukeshimizu
1
170
MIXIで活躍できるエンジニアを 若手社員目線で考えてみる
mixi_engineers
PRO
0
130
LanceDB入門
mocobeta
9
670
Software Supply Chain Attackからクラウド環境を守るためにできること
lhazy
2
290
同じWAFが、攻撃の“形”は弾く── 正当な“形”の不正は通す
kuroneko13
0
270
型落ちシンクライアント端末のPoEモジュールを自作したかった話
logica0419
0
310
平文パスワードはログに“残り” ── 肝心の侵入は“痕跡すら残らない”
kuroneko13
0
120
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
tamachi.go 誕生の裏側
rymiyamoto
1
200
Rust×eBPFでEDRっぽいものをつくる
sunlife3
2
810
英語が話せなくてもKubeConスタッフに参加した話
yusuke427
2
1.1k
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
310
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
290
Designing for Performance
lara
611
70k
Statistics for Hackers
jakevdp
799
230k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
710
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
380
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
How STYLIGHT went responsive
nonsquared
100
6.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Transcript
Persisted-queryをやってみた @indigolain
Who am I? • indigolain / 上原拓也 • Rails /
React / GraphQL • 最近個人プロジェクトでUnityで3Dサウンドを使ったゲーム を作ろうと試行錯誤しています
Automatic Persisted Queries • Apolloが提供しているPersisted Queryの仕組み • リクエストを小さくする、もしくはcacheを使うことを目的としたもの ◦ 望まないクエリの排除などの機能はない
• apollo-server, apollo-clientなどapolloなライブラリを組み合わせると ある程度動くものがさらっとできます
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
すごい、便利
でも・・・ • 登録されているクエリ-ハッシュのペアをコードで管理したい • 登録されるクエリ-ハッシュのペアをレビューできるようにして、どのような クエリが呼ばれる可能性があるのか把握したい リクエストされるクエリを把握し、 新しく送られるクエリについてPRなどで議論できるようにしたい
でも・・・ クライアントのコードから クエリ-ハッシュがペアになっている JSONを自動生成できるようになれば コード化 && レビュー できるのでは • 登録されているクエリ-ハッシュのペアをコードで管理したい
• 登録されるクエリ-ハッシュのペアをレビューできるようにして、どのような クエリが呼ばれる可能性があるのか把握したい
{ "version": 2, "operations": [ { "signature": "e5f…...", "document": "query
UpdateQuery….", "metadata": { "engineSignature": "" } }, ….. ] } query UpdateQuery($courseId: ID!) { updateQuery(id: $id) { …... } } Query JSON apollo client:extract https://github.com/apollographql/apollo-tooling#apollo-clientextract-output query UpdateQuery2($courseId: ID!) { updateQuery2(id: $id) { …... } } JSON生成 & PR化
JSONを参照して hash → クエリする処理 https://www.apollographql.com/docs/apollo-server/performance/apq/
None
None
None
None
None
TODO • 生成したJSONの管理の仕方 ◦ NativeアプリのバージョンによってJSONを分離する? ◦ Nativeクライアントの種類によってJSONを分離する? • etc…. 話したこと
• ApolloのAutomatic Persisted Queriesの仕組みを活用しつつ、 persistするクエリをJSONで自由に登録できるようにした • JSONで発行されるクエリをコード化することによって、クライアントから呼 ばれるクエリをレビューするための仕組みができた
fin