@gemmein/sdk 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/llms.txt +36 -21
  2. package/package.json +2 -2
package/llms.txt CHANGED
@@ -185,28 +185,43 @@
185
185
  arriving out of order resolve to the newest. The app reads
186
186
  `await g.subscriptions.mine()` → `{ plan, status }` or null, and gates features
187
187
  with `sub?.plan === "pro"`.
188
- - Selling THINGS (one-off purchases a poster, a beat, an ebook): plans are
189
- for subscriptions; products are for things. The builder adds products
190
- (name + Stripe Payment Link) on the same Payments page and picks a
191
- receipts collection (rule `addressed`). The app calls
192
- `await g.payments.buy("poster")` or, when one product covers many items (license
188
+ - Paid ACCESS (entitlements): a collection can require a key your human
189
+ sets `requires: "access:pro"` in its settings and the engine refuses
190
+ anyone without it, on every operation, under all seven rules. Keys are
191
+ granted by money: a plan or product lists what it unlocks (e.g.
192
+ `access:pro, access:exports`), the paid webhook grants those keys, and a
193
+ refund or cancellation revokes exactly what it granted — nothing else.
194
+ Owners also grant and revoke by hand (trials, comps, support). Effective
195
+ access is the UNION of a customer's live grants. A signed-in customer
196
+ without the key gets `403 entitlement_required` naming it — show your
197
+ upgrade screen and send them to checkout; never retry. Proof surfaces:
198
+ `await g.purchases.mine()` (everything they paid for, refunds applied,
199
+ with the `grants` each purchase carries) and `await g.subscriptions.mine()`.
200
+ NO credits, NO usage limits, NO seats — access is yes-or-no by design.
201
+ - Selling THINGS (one-off purchases — a beat, an ebook, a course; DIGITAL
202
+ access only — physical goods, shipping, inventory and carts are out of
203
+ scope, said out loud): plans are for subscriptions; products are for
204
+ things. The builder adds products (name + Stripe Payment Link) on the
205
+ same Payments page. The app calls
206
+ `await g.payments.buy("beat")` — or, when one product covers many items (license
193
207
  tiers over a catalog), names the item:
194
- `await g.payments.buy("premium license", { item: "beat_37" })` (display text on
195
- the receipt; the PRICE always comes from the product's Payment Link, so
196
- the item note can never change what's paid). The completed payment writes
197
- a receipt record ADDRESSED to the buyer: only they and the owner read it.
198
- Gate downloads/fulfilment on the receipt, never on the redirect coming
199
- back redirects can be faked, receipts come from Stripe's signed
200
- webhook. Receipts carry
201
- { product, item?, status: "paid"|"refunded", amountTotal (minor units,
202
- as Stripe said), currency, paidAt, deliveryUrl?, paymentRef } deliveryUrl appears
203
- when the builder attached a delivery link to the product (that's how
204
- digital goods deliver themselves; never put a secret download URL in a
205
- public collection). Fulfilment status changes ("shipped") are the owner
206
- editing the receipt in their dashboard; your app just re-reads it.
207
- NO carts, NO quantities one product per checkout by design; a cart is
208
- N checkouts or one bundled product. 404 unknown_product lists what the
209
- app actually sells use those names.
208
+ `await g.payments.buy("premium license", { item: "beat_37" })` (display text
209
+ only; the PRICE always comes from the product's Payment Link, so the
210
+ item note can never change what's paid). Gemmein records every completed
211
+ payment itself `await g.purchases.mine()` is the buyer's proof:
212
+ { item, kind, status: "paid"|"part_refunded"|"refunded", amountMinor,
213
+ currency, refundedMinor, grants, paidAt }. A receipts collection (rule
214
+ `addressed`) is OPTIONAL — add one when you want receipts as records the
215
+ app renders; only the buyer and the owner read them. Delivery: attach
216
+ the thing to the product a sealed Gemmein file (the receipt carries a
217
+ `file:` ref; resolve it per reader with `g.files.link`, which re-checks
218
+ access on every mint) or an external `deliveryUrl` (a plain handover:
219
+ Gemmein controls who is TOLD, not who can use it). Gate fulfilment on
220
+ the purchase or the entitlement it granted, never on the redirect coming
221
+ back redirects can be faked; the record comes from Stripe's signed
222
+ webhook. NO carts, NO quantities — one product per checkout by design; a
223
+ cart is N checkouts or one bundled product. 404 unknown_product lists
224
+ what the app actually sells — use those names.
210
225
  - Drafts on PUBLIC collections (public_read, community): create with the
211
226
  OPTION `{ published: false }` → hidden from every reader except its
212
227
  author and the owner, server-enforced; publish with
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gemmein/sdk",
3
- "version": "0.3.0",
4
- "description": "Gemmein SDK \u2014 passwordless auth, safe storage, and Stripe-driven record flips for AI-built apps. Small enough that one prompt teaches the whole API.",
3
+ "version": "0.3.1",
4
+ "description": "Gemmein SDK passwordless auth, safe storage, and Stripe-driven record flips for AI-built apps. Small enough that one prompt teaches the whole API.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",