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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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.1k
フロントエンドチーム立ち上げで学んだTips / What I learned from organizing the new frontend team
indigolain
0
2.8k
TEC DEPT 201610 Catal Engineer5期生募集
indigolain
0
490
なるほど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
きのこカンファレンス2026_肩書きを外したとき私は誰か
yamasatimi
1
130
飲食店もAIで。レジ締めやハンディシステムをつくってる話 / Using AI for restaurant management
vtryo
0
240
從觀望到全公司落地:AI Agentic Coding 導入實戰 — 流程整合與安全治理
appleboy
1
780
Keeping applications secure by evolving OAuth 2.0 and OpenID Connect
ahus1
PRO
1
140
次世代ランサムウェア対策の考察 / 20260704 Mitsutoshi Matsuo
shift_evolve
PRO
5
1.7k
Hatena Engineer Seminar 37 jj1uzh
jj1uzh
0
430
デジタル・デザイン:次の50年を描く「進化する青写真」
y150saya
0
810
依頼文化をやめる日 EM視点で語るPlatform EngineeringとInclusive SRE / Discussing Platform Engineering and Inclusive SRE from an EM's Perspective
shin1988
3
1.8k
AI時代における最適なQA組織の作り方
ymty
3
370
Baseline対応のDOMの型定義を作った
uhyo
3
680
ゼロをイチにする仕事が終わったあと
smasato
0
290
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
250
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
220
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
410
The Art of Programming - Codeland 2020
erikaheidi
57
14k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Context Engineering - Making Every Token Count
addyosmani
9
1k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Ruling the World: When Life Gets Gamed
codingconduct
0
270
sira's awesome portfolio website redesign presentation
elsirapls
0
290
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
640
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
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