You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 17, 2025. It is now read-only.
## Summary
- replace handwritten models with openiap-gql generated Types.kt
- rewire OpenIapModule, store, and sample screens to the new handlers
- fail CI when Types.kt regeneration alters the tree
-`CONVENTION.md`: authoritative engineering conventions for this repo.
11
+
12
+
## How To Work Here
13
+
14
+
1. Start every session by reading `CONVENTION.md`. It documents critical rules such as the prohibition on editing generated files (`openiap/src/main/Types.kt`) and where to place shared helper code (`openiap/src/main/java/dev/hyo/openiap/utils/…`).
15
+
2. Treat generated sources as read-only. If a change requires updating them, run `./scripts/generate-types.sh` instead of hand editing.
16
+
3. Put all reusable Kotlin helpers (e.g., safe map accessors) into the `utils` package so they can be used without modifying generated output.
17
+
4. After code generation or dependency changes, compile with `./gradlew :openiap:compileDebugKotlin` (or the appropriate target) to verify the build stays green.
18
+
19
+
Refer back to this document and `CONVENTION.md` whenever you are unsure about workflow expectations.
-`openiap/src/main/Types.kt` is auto-generated. Regenerate it with `./scripts/generate-types.sh` after changing any GraphQL schema files.
6
+
- Never edit `Types.kt` manually. Regeneration guarantees consistency across platforms and avoids merge conflicts.
7
+
- When additional parsing or conversion helpers are needed for GraphQL payloads, place them in a utility file (for example `openiap/src/main/java/dev/hyo/openiap/utils/JsonUtils.kt`). Keep all custom helpers outside of generated sources and have the hand-written code call into them.
8
+
9
+
## Helper Utilities
10
+
11
+
- Shared helper extensions such as safe `Map<String, *>` lookups must live in utility sources (`utils/*.kt`) so they can be reused without modifying generated files.
12
+
- Utility files should include succinct KDoc explaining their intent and reference the convention above when interacting with generated code.
13
+
14
+
## Android Module API Handlers
15
+
16
+
- The Android `OpenIapModule` exposes every GraphQL operation through the typealias handlers defined in `Types.kt` (e.g. `MutationInitConnectionHandler`, `QueryGetAvailablePurchasesHandler`, etc.).
17
+
- These handlers are declared as properties (for example `val initConnection = ...`) inside `OpenIapModule`; they encapsulate all coroutine work (`withContext`, `suspendCancellableCoroutine`, etc.) and return the types required by the GraphQL schema (e.g. `RequestPurchaseResult`).
18
+
-`OpenIapStore` and other consumers must call the module through these handler properties rather than direct suspend functions, unpacking any wrapper results (such as `RequestPurchaseResultPurchases`) as needed.
19
+
- Keep helper wiring inside `OpenIapModule`—avoid reintroducing extension builders like `createQueryHandlers`; the module itself owns `queryHandlers`, `mutationHandlers`, and `subscriptionHandlers` values so wiring stays localized and in sync with the typealiases.
20
+
21
+
## Regeneration Checklist
22
+
23
+
- Run `./scripts/generate-types.sh` whenever GraphQL schema definitions change.
24
+
- After regenerating, run the relevant Gradle targets (e.g. `./gradlew :openiap:compileDebugKotlin`) to ensure the generated output compiles together with existing handwritten code.
0 commit comments