@flow-industries/id 0.21.2 → 0.22.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 (47) hide show
  1. package/README.md +52 -0
  2. package/contracts/v1/openapi.json +818 -0
  3. package/contracts/v1/reports.json +188 -0
  4. package/contracts/v1/sdk-exports.json +1165 -0
  5. package/dist/sdk/client/create-flow.js +2 -5
  6. package/dist/sdk/client/dialog-host.js +11 -6
  7. package/dist/sdk/client/flow-widget.js +3 -3
  8. package/dist/sdk/client/focus-session.d.ts +18 -0
  9. package/dist/sdk/client/focus-session.js +140 -0
  10. package/dist/sdk/client/focus.d.ts +11 -0
  11. package/dist/sdk/client/focus.js +30 -0
  12. package/dist/sdk/client/iframe-host.d.ts +2 -1
  13. package/dist/sdk/client/iframe-host.js +11 -1
  14. package/dist/sdk/client/index.d.ts +4 -1
  15. package/dist/sdk/client/index.js +2 -0
  16. package/dist/sdk/client/json-api.d.ts +1 -1
  17. package/dist/sdk/client/json-api.js +3 -1
  18. package/dist/sdk/client/open-profile.js +10 -7
  19. package/dist/sdk/client/profile-button.js +16 -9
  20. package/dist/sdk/client/reports.d.ts +9 -0
  21. package/dist/sdk/client/reports.js +30 -0
  22. package/dist/sdk/client/rooms.js +7 -26
  23. package/dist/sdk/client/study-search.d.ts +20 -0
  24. package/dist/sdk/client/study-search.js +116 -0
  25. package/dist/sdk/contracts/http.d.ts +155 -0
  26. package/dist/sdk/contracts/http.js +91 -0
  27. package/dist/sdk/contracts/reports.d.ts +130 -0
  28. package/dist/sdk/contracts/reports.js +67 -0
  29. package/dist/sdk/dialog/remote/Messenger.d.ts +3 -0
  30. package/dist/sdk/dialog/remote/Messenger.js +9 -3
  31. package/dist/sdk/react/use-cooldown.d.ts +1 -0
  32. package/dist/sdk/react/use-cooldown.js +12 -0
  33. package/dist/sdk/types/auth.d.ts +12 -0
  34. package/dist/sdk/types/dialog.d.ts +25 -0
  35. package/dist/sdk/types/focus.d.ts +109 -0
  36. package/dist/sdk/types/focus.js +0 -0
  37. package/dist/sdk/types/index.d.ts +8 -3
  38. package/dist/sdk/types/landing.d.ts +9 -0
  39. package/dist/sdk/types/landing.js +0 -0
  40. package/dist/sdk/types/otp.d.ts +20 -0
  41. package/dist/sdk/types/otp.js +0 -0
  42. package/dist/sdk/types/reports.d.ts +7 -0
  43. package/dist/sdk/types/reports.js +0 -0
  44. package/dist/sdk/types/settings.d.ts +162 -0
  45. package/dist/sdk/types/settings.js +0 -0
  46. package/dist/sdk/types/xp.d.ts +8 -0
  47. package/package.json +21 -9
package/README.md CHANGED
@@ -82,3 +82,55 @@ pointer lock before opening, then use `onClose` to restore their input state.
82
82
  ## License
83
83
 
84
84
  MIT
85
+
86
+
87
+ ### Migration compatibility checks
88
+
89
+ `bun run db:check` regenerates into a temporary directory and refuses schema drift or edits
90
+ to previously committed SQL. CI compares against the PR base or previous main commit.
91
+ `bun run test:migrations` exercises the committed chain, the supported previous schema,
92
+ current projections, older writes after upgrade, and deliberate missing-migration failures.
93
+ `MIGRATION_TEST_DATABASE_URL=postgres://... bun scripts/postgres-acceptance.ts` additionally
94
+ creates a unique disposable database on a test PostgreSQL server, runs the real migration
95
+ entrypoint, rejects a changed applied hash, and proves a failing final migration rolls back
96
+ both its schema changes and ledger entry. The test deletes only its own generated database.
97
+
98
+ The initial compatibility baseline is source `1bda372b69e2f66a3dc0cbb244bcbe7cb858f493` (schema through `0035`).
99
+ The tests freeze representative older SQL reads/writes; they do not boot every historical
100
+ application version. Advance this baseline deliberately when retiring support, and extend
101
+ the fixtures when changing a persisted contract. Migration failures block the image build;
102
+ production's PreSync job also refuses an applied ledger that is not an exact committed prefix.
103
+
104
+ Application rollback keeps the expanded schema. Pin the latest verified migration image via
105
+ Mesh's `migrate.image` while restoring the previous compatible application image. Do not run
106
+ down migrations or point an older migration image at a newer ledger: that is refused. A
107
+ destructive contract migration needs an explicit support-boundary change after older writers
108
+ and browser clients have drained.
109
+
110
+ ## Versioned consumer contracts
111
+
112
+ `bun run contracts:generate` produces the published
113
+ `@flow-industries/id/contracts/v1/reports.json` and `openapi.json` artifacts from
114
+ the same schemas used by the XP, action, presence and position handlers.
115
+ `bun run contracts:check` rejects stale output and incompatible changes to the
116
+ existing v1 request schema against `CONTRACT_BASE_REF` (default `origin/main`).
117
+ Keep existing v1 fields compatible; a breaking boundary needs a new version and
118
+ an overlap plan for deployed consumers.
119
+
120
+ Trusted service consumers can call `createReportsApi(host, serviceToken)` from
121
+ `@flow-industries/id`. The returned function accepts the operation name and its
122
+ typed request, validates both the outgoing request and successful response, and
123
+ throws `ReportRequestError` for non-success responses. Use the XP reporting
124
+ credential for action/XP operations and the room credential for presence/position;
125
+ never ship either service credential to a browser.
126
+
127
+ `bun run test:sdk-package` builds, packs and installs the actual SDK artifact in
128
+ a disposable consumer, checks public imports and declarations, and proves a
129
+ removed contract export fails. Producer tests execute the typed client against
130
+ real report handlers and validate minted guest/full session and JWT shapes.
131
+ CI gates both container and package publication on these checks.
132
+
133
+ The current OpenAPI artifact describes the service report boundary. The remaining
134
+ account, room management, study, settings, session and passkey HTTP operations
135
+ still need complete request/response descriptions and generated client coverage
136
+ before the full HTTP contract work is complete.