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
AI ネイティブな組織に Gemini Enterprise Agent Platform がなぜ必要なのか
asei
1
180
事業価値と Engineering 2026年度版
recruitengineers
PRO
41
21k
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
110
モバイルアプリ開発概論2026
recruitengineers
PRO
3
420
AIがAPIを書く時代に、私たちは何を設計すべきか
nagix
0
220
システム思考で問題に対処する
yussak
0
160
[ChatGPT Work LT]事務作業が苦手な人のための バックオフィスの「半」自動化
chimaki_iot
0
230
Retriever と Reranker、結局どうする?
kazuaki
3
680
Goでデータパイプラインを作ろう
sansantech
PRO
0
320
Pavlokで始める電撃駆動開発
sgrsn
0
170
ガバメント AI 源内を地方自治体は活用できるのか可能性と課題、期待について
takeda_h
1
250
初めてのGitHub Actions / GitHub Actions at First
tooppoo
0
140
Featured
See All Featured
Design in an AI World
tapps
1
270
New Earth Scene 8
popppiees
3
2.5k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Abbi's Birthday
coloredviolet
3
9.2k
Deep Space Network (abreviated)
tonyrice
0
250
Between Models and Reality
mayunak
4
380
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
200
WCS-LA-2024
lcolladotor
0
790
A Soul's Torment
seathinner
6
3.4k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
620
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
400
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