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
初めてのGitHub Actions / GitHub Actions at First
tooppoo
0
120
AIエージェントに財布を渡す日 ― 承認付き"買い物エージェント"を作って実演
yama3133
1
110
plamo-3-translateの開発
pfn
PRO
0
250
A Bag-of-Documents Model for Query Specificity
dtunkelang
0
200
Amazon Bedrock Managed Knowledge BaseDive Deep
ren8k
0
340
StepFunctionsとGraphRAGを活用した暗黙知活用のためのRAG基盤
yakumo
1
200
AI エージェント時代のデジタルアイデンティティ
fujie
2
1.3k
NetBoxを利用した作業効率化の試み_NetDevNight4
tnoha
0
430
VPCセキュリティ対応の最新事情
nagisa53
2
350
AI ネイティブな組織に Gemini Enterprise Agent Platform がなぜ必要なのか
asei
1
150
Webの技術とガジェットで子どもも大人も楽しめるワクワク体験を提供する / Qiita Tech Festa Day 2026
you
PRO
1
330
現場で使える AWS DevOps Agent 活用ノウハウ - Release Management 機能の検証結果を添えて / AWS DevOps Agent Release Management and Know-How
kinunori
5
860
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Chasing Engaging Ingredients in Design
codingconduct
0
250
Typedesign – Prime Four
hannesfritz
42
3.1k
Thoughts on Productivity
jonyablonski
76
5.3k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
Building Adaptive Systems
keathley
44
3.2k
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