@quatronic/sdk 0.10.1-rc.1 → 0.10.1-test.97e91bf

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 (78) hide show
  1. package/README.md +6 -0
  2. package/dist/chunk-JM5LHJUJ.js +32 -0
  3. package/dist/chunk-JM5LHJUJ.js.map +1 -0
  4. package/dist/{chunk-YFZB5EW6.js → chunk-P5GBQVO7.js} +2 -2
  5. package/dist/{chunk-IFESUTF2.js → chunk-VQKYPW5V.js} +7 -3
  6. package/dist/chunk-VQKYPW5V.js.map +1 -0
  7. package/dist/{chunk-POZI4OKJ.js → chunk-WOFBDOMY.js} +2 -2
  8. package/dist/{chunk-TPBRMW5N.js → chunk-YCKDMG4B.js} +30 -1
  9. package/dist/chunk-YCKDMG4B.js.map +1 -0
  10. package/dist/chunk-YJZZURE4.js +83 -0
  11. package/dist/chunk-YJZZURE4.js.map +1 -0
  12. package/dist/cli/skills-postinstall.js +13 -6
  13. package/dist/cli/skills.js +11 -5
  14. package/dist/context-CWvUIBHJ.d.ts +196 -0
  15. package/dist/eslint/index.d.ts +11 -1
  16. package/dist/eslint/index.js +123 -4
  17. package/dist/eslint/index.js.map +1 -1
  18. package/dist/expo/auth/index.d.ts +14 -0
  19. package/dist/expo/auth/index.js +324 -0
  20. package/dist/expo/auth/index.js.map +1 -0
  21. package/dist/expo/config/index.d.ts +38 -0
  22. package/dist/expo/config/index.js +35 -0
  23. package/dist/expo/config/index.js.map +1 -0
  24. package/dist/expo/log/index.d.ts +9 -0
  25. package/dist/expo/log/index.js +16 -0
  26. package/dist/expo/log/index.js.map +1 -0
  27. package/dist/expo/query/index.d.ts +41 -0
  28. package/dist/expo/query/index.js +98 -0
  29. package/dist/expo/query/index.js.map +1 -0
  30. package/dist/expo/sentry/index.d.ts +33 -0
  31. package/dist/expo/sentry/index.js +100 -0
  32. package/dist/expo/sentry/index.js.map +1 -0
  33. package/dist/expo/testing/index.d.ts +32 -0
  34. package/dist/expo/testing/index.js +58 -0
  35. package/dist/expo/testing/index.js.map +1 -0
  36. package/dist/next/auth/index.d.ts +50 -0
  37. package/dist/next/auth/index.js +523 -101
  38. package/dist/next/auth/index.js.map +1 -1
  39. package/dist/next/boot/index.js +3 -3
  40. package/dist/next/db/index.js +1 -1
  41. package/dist/next/security/index.d.ts +24 -1
  42. package/dist/next/security/index.js +29 -0
  43. package/dist/next/security/index.js.map +1 -1
  44. package/dist/next/sentry/client.js +3 -3
  45. package/dist/next/sentry/client.js.map +1 -1
  46. package/dist/next/sentry/index.js +1 -1
  47. package/dist/next/sentry/register.js +3 -3
  48. package/dist/node/sentry/index.js +1 -1
  49. package/dist/node/sentry/register.js +2 -2
  50. package/package.json +75 -2
  51. package/skills/catalog.json +3 -0
  52. package/skills/qore-add-api-route/SKILL.md +1 -1
  53. package/skills/qore-add-connection/SKILL.next.md +3 -1
  54. package/skills/qore-add-connection/SKILL.node.md +3 -1
  55. package/skills/qore-add-env-key/SKILL.md +174 -9
  56. package/skills/qore-add-feature/SKILL.md +1 -1
  57. package/skills/qore-add-integration/SKILL.next.md +4 -2
  58. package/skills/qore-add-integration/SKILL.node.md +6 -6
  59. package/skills/qore-add-page/SKILL.md +1 -1
  60. package/skills/qore-author-skill/SKILL.md +1 -1
  61. package/skills/qore-debug-issue/SKILL.md +10 -0
  62. package/skills/qore-mobile-add-screen/SKILL.md +64 -0
  63. package/skills/qore-mobile-call-server/SKILL.md +75 -0
  64. package/skills/qore-mobile-run-on-device/SKILL.md +44 -0
  65. package/skills/qore-observability/SKILL.md +17 -0
  66. package/skills/qore-secure-io/SKILL.md +15 -0
  67. package/skills/qore-ship-checklist/SKILL.md +10 -0
  68. package/skills/qore-translate-strings/SKILL.md +10 -0
  69. package/skills/qore-use-addons/SKILL.md +2 -0
  70. package/skills/qore-use-database/SKILL.md +2 -0
  71. package/skills/qore-use-design-system/SKILL.md +1 -1
  72. package/skills/qore-use-mail-domain/SKILL.next.md +1 -1
  73. package/skills/qore-use-mail-domain/SKILL.node.md +2 -2
  74. package/skills/qore-use-permissions/SKILL.md +10 -0
  75. package/dist/chunk-IFESUTF2.js.map +0 -1
  76. package/dist/chunk-TPBRMW5N.js.map +0 -1
  77. /package/dist/{chunk-YFZB5EW6.js.map → chunk-P5GBQVO7.js.map} +0 -0
  78. /package/dist/{chunk-POZI4OKJ.js.map → chunk-WOFBDOMY.js.map} +0 -0
@@ -43,6 +43,34 @@ type NextAuthOptions = {
43
43
  sessionIdleTimeoutSec?: number;
44
44
  /** Hard ceiling no activity can extend. Default 12h. */
45
45
  sessionAbsoluteMaxSec?: number;
46
+ /** Turns on sign-in for the app's own Expo app (`@quatronic/sdk/expo/auth`).
47
+ * Absent: every `/api/auth/mobile/*` route answers 404 and no bearer token
48
+ * is accepted anywhere. See `MobileAuthOptions`. */
49
+ mobile?: MobileAuthOptions;
50
+ };
51
+ /** Server half of mobile sign-in. The phone opens `/api/auth/mobile/login` in
52
+ * an in-app browser with its PKCE challenge; the callback sends a one-shot
53
+ * code back to the app's URL scheme; the app redeems it at
54
+ * `/api/auth/mobile/redeem` for a session token it sends as
55
+ * `Authorization: Bearer` from then on. `requireAuth`, `getAccessToken` and
56
+ * `/api/auth/me` accept that header, so the app's own API routes serve the
57
+ * phone unchanged. */
58
+ type MobileAuthOptions = {
59
+ /** The app's URL schemes, e.g. `["acme-orders", "acme-orders-stag"]`. A login
60
+ * may only return to `<scheme>://auth/return`. */
61
+ schemes: readonly string[];
62
+ /** Also accept `exp://…/--/auth/return` (Expo Go during development). Never
63
+ * in production: any Expo Go project could then receive a code. */
64
+ allowExpoGo?: boolean;
65
+ /** Mobile session dies after this long without use. Default 30 days. */
66
+ sessionIdleTimeoutSec?: number;
67
+ /** Hard ceiling for a mobile session. Default 90 days. */
68
+ sessionAbsoluteMaxSec?: number;
69
+ /** Ask Keycloak for `offline_access` on a mobile login, so the refresh token
70
+ * outlives the realm's SSO session (the 30/90-day bounds above then hold).
71
+ * The app's Keycloak client must list `offline_access` as an optional
72
+ * scope, or every mobile login fails with `invalid_scope`. Default false. */
73
+ offlineAccess?: boolean;
46
74
  };
47
75
 
48
76
  type AuthRouteHandlers = {
@@ -94,6 +122,11 @@ declare function createKcClient(cfg: KcConfig): {
94
122
  prompt?: string;
95
123
  maxAge?: number;
96
124
  idTokenHint?: string;
125
+ /** Added to the configured scope for this one request, e.g. a mobile
126
+ * login's `offline_access`. The client must allow each one in Keycloak. */
127
+ extraScopes?: readonly string[];
128
+ /** Language for Keycloak's own pages (OIDC `ui_locales`). */
129
+ uiLocales?: string;
97
130
  }) => string;
98
131
  buildEndSessionUrl: (args: {
99
132
  postLogoutRedirectUri: string;
@@ -125,7 +158,10 @@ type CreateSessionInput = {
125
158
  refreshToken: string;
126
159
  refreshExpiresAt: Date;
127
160
  pendingIdentityConfirm?: boolean;
161
+ /** "web" (cookie, the default) or "mobile" (bearer token held by a phone). */
162
+ kind?: SessionKind;
128
163
  };
164
+ type SessionKind = "web" | "mobile";
129
165
  type Session = {
130
166
  id: string;
131
167
  userSub: string;
@@ -139,6 +175,9 @@ type Session = {
139
175
  refreshExpiresAt: Date;
140
176
  createdAt: Date;
141
177
  updatedAt: Date;
178
+ /** Always set on a row read from the store; absent only on hand-built
179
+ * values, where it reads as "web" — so a bearer check fails closed. */
180
+ kind?: SessionKind;
142
181
  };
143
182
  type RotateInput = {
144
183
  accessToken: string;
@@ -199,6 +238,12 @@ declare function requireAuth(opts: {
199
238
  * would silently become the session's real lifetime. */
200
239
  idleTimeoutSec?: number;
201
240
  absoluteMaxSec?: number;
241
+ /** Set when the server enabled mobile sign-in: an `Authorization: Bearer`
242
+ * session token is accepted when there is no cookie, with these bounds. */
243
+ mobile?: {
244
+ idleTimeoutSec: number;
245
+ absoluteMaxSec: number;
246
+ };
202
247
  }): () => Promise<AuthUser>;
203
248
 
204
249
  declare function requireAuthFor(opts: NextAuthOptions): Promise<() => Promise<AuthUser>>;
@@ -216,6 +261,11 @@ type GetAccessTokenDeps = {
216
261
  * would silently become the session's real lifetime. */
217
262
  idleTimeoutSec?: number;
218
263
  absoluteMaxSec?: number;
264
+ /** Set when the server enabled mobile sign-in; see `requireAuth`. */
265
+ mobile?: {
266
+ idleTimeoutSec: number;
267
+ absoluteMaxSec: number;
268
+ };
219
269
  };
220
270
  declare function getAccessToken(opts: GetAccessTokenDeps): () => Promise<string | null>;
221
271
  declare function requireAccessToken(opts: GetAccessTokenDeps): () => Promise<string>;