franchising 0.0.0-stage → 0.2.0
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.
- package/LICENSE +61 -0
- package/README.md +96 -2
- package/dist/accounts-B4bnTXUd.js +242 -0
- package/dist/accounts-B4bnTXUd.js.map +1 -0
- package/dist/accounts-TyMPSHM0.cjs +313 -0
- package/dist/accounts-TyMPSHM0.cjs.map +1 -0
- package/dist/adapters-DM59AJfR.d.cts +216 -0
- package/dist/adapters-DM59AJfR.d.ts +216 -0
- package/dist/cli/template-assets/api/src/errors/codes.ts +17 -0
- package/dist/cli/template-assets/api/src/errors/index.ts +16 -0
- package/dist/cli/template-assets/api/src/filters/exception.ts +53 -0
- package/dist/cli/template-assets/api/src/main.ts +189 -0
- package/dist/cli/template-assets/api/src/modules/health/controller.ts +23 -0
- package/dist/cli/template-assets/api/src/modules/health/dto/response.dto.ts +23 -0
- package/dist/cli/template-assets/api/src/modules/health/module.ts +12 -0
- package/dist/cli/template-assets/api/src/modules/health/service.ts +54 -0
- package/dist/cli/template-assets/api/src/modules/messaging/module.ts +7 -0
- package/dist/cli/template-assets/api/src/modules/messaging/service.ts +74 -0
- package/dist/cli/template-assets/api/src/shared/exceptions.ts +40 -0
- package/dist/cli/template-assets/api/src/shared/response.ts +31 -0
- package/dist/cli/template-assets/api/src/telemetry.ts +59 -0
- package/dist/cli/template-assets/api/src/types.ts +8 -0
- package/dist/cli/template-assets/cloudflare/cache.service.ts +23 -0
- package/dist/cli/template-assets/cloudflare/queue.service.ts +22 -0
- package/dist/cli/template-assets/cloudflare/worker.ts +33 -0
- package/dist/cli/template-assets/packages/jobs/src/index.ts +49 -0
- package/dist/cli/template-assets/packages/queue-runtime/src/index.ts +54 -0
- package/dist/cli/template-assets/root/dot-dockerignore +11 -0
- package/dist/cli/template-assets/root/dot-editorconfig +13 -0
- package/dist/cli/template-assets/root/dot-oxfmtrc.json +9 -0
- package/dist/cli/template-assets/root/dot-oxlintrc.json +47 -0
- package/dist/cli/template-assets/root/lefthook.yml +18 -0
- package/dist/cli/template-assets/web/postcss.config.mjs +9 -0
- package/dist/cli/template-assets/web/src/app/(app)/dashboard/page.tsx +5 -0
- package/dist/cli/template-assets/web/src/app/(app)/layout.tsx +25 -0
- package/dist/cli/template-assets/web/src/app/(auth)/login/page.tsx +75 -0
- package/dist/cli/template-assets/web/src/app/globals.css +48 -0
- package/dist/cli/template-assets/web/src/app/layout.tsx +30 -0
- package/dist/cli/template-assets/web/src/app/page.tsx +20 -0
- package/dist/cli/template-assets/web/src/components/overview/overview-panel.tsx +27 -0
- package/dist/cli/template-assets/web/src/components/shell/app-shell.tsx +37 -0
- package/dist/cli/template-assets/web/src/components/shell/providers.tsx +22 -0
- package/dist/cli/template-assets/web/src/lib/api-client.ts +57 -0
- package/dist/cli/template-assets/web/src/lib/auth-client.ts +15 -0
- package/dist/cli/template-assets/web/src/lib/server-auth.ts +38 -0
- package/dist/cli/template-assets/web/src/types/api.ts +18 -0
- package/dist/cli/template-assets/worker/src/app.module.ts +5 -0
- package/dist/cli/template-assets/worker/src/env.ts +8 -0
- package/dist/cli/template-assets/worker/src/main.ts +25 -0
- package/dist/cli/template-assets/worker/src/modules/queue/config.ts +16 -0
- package/dist/cli/template-assets/worker/src/modules/queue/module.ts +11 -0
- package/dist/cli/template-assets/worker/src/modules/queue/processor.ts +105 -0
- package/dist/cli/template-assets/worker/src/modules/queue/repository.ts +16 -0
- package/dist/cli/template-assets/worker/src/modules/queue/retry.ts +17 -0
- package/dist/cli/template-assets/worker/test/retry.test.ts.tpl +12 -0
- package/dist/cli/template-assets/worker-messaging/jobs-messaging.ts +12 -0
- package/dist/cli/template-assets/worker-messaging/messaging-api-service.ts +39 -0
- package/dist/cli/template-assets/worker-messaging/src/env.ts +14 -0
- package/dist/cli/template-assets/worker-messaging/src/modules/messaging/service.ts +59 -0
- package/dist/cli/template-assets/worker-messaging/src/modules/queue/module.ts +8 -0
- package/dist/cli/template-assets/worker-messaging/src/modules/queue/processor.ts +113 -0
- package/dist/cli.js +1218 -0
- package/dist/cn-BVOnrSza.js +1 -0
- package/dist/constants-C4iP0--i.js +38 -0
- package/dist/constants-C4iP0--i.js.map +1 -0
- package/dist/constants-rCR-LNSN.cjs +91 -0
- package/dist/constants-rCR-LNSN.cjs.map +1 -0
- package/dist/core-BidJDmSN.cjs +759 -0
- package/dist/core-BidJDmSN.cjs.map +1 -0
- package/dist/core-C-EFrEd6.js +710 -0
- package/dist/core-C-EFrEd6.js.map +1 -0
- package/dist/decorate-BR5FVX5x.js +14 -0
- package/dist/decorate-R-oqksAh.cjs +25 -0
- package/dist/decorateParam-BFJPEGKJ.cjs +13 -0
- package/dist/decorateParam-CKE7_J1s.js +8 -0
- package/dist/define-adapter-Cc0QrfKt.cjs +16 -0
- package/dist/define-adapter-Cc0QrfKt.cjs.map +1 -0
- package/dist/define-adapter-DRcXno3j.js +11 -0
- package/dist/define-adapter-DRcXno3j.js.map +1 -0
- package/dist/dispatcher-BsD7cO2w.cjs +84 -0
- package/dist/dispatcher-BsD7cO2w.cjs.map +1 -0
- package/dist/dispatcher-DA_l1Vkv.js +73 -0
- package/dist/dispatcher-DA_l1Vkv.js.map +1 -0
- package/dist/errors-DxHoXrLd.d.cts +46 -0
- package/dist/errors-DxHoXrLd.d.ts +46 -0
- package/dist/http/index.cjs +440 -0
- package/dist/http/index.cjs.map +1 -0
- package/dist/http/index.d.cts +257 -0
- package/dist/http/index.d.ts +257 -0
- package/dist/http/index.js +400 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/swagger.cjs +122 -0
- package/dist/http/swagger.cjs.map +1 -0
- package/dist/http/swagger.d.cts +59 -0
- package/dist/http/swagger.d.ts +59 -0
- package/dist/http/swagger.js +117 -0
- package/dist/http/swagger.js.map +1 -0
- package/dist/index--EJQTnHy.d.cts +174 -0
- package/dist/index-B3aVdDMV.d.cts +51 -0
- package/dist/index-BDYdEWl2.d.cts +833 -0
- package/dist/index-BDYdEWl2.d.ts +833 -0
- package/dist/index-Bdl0AiNM.d.ts +1262 -0
- package/dist/index-By8b4ksT.d.ts +25 -0
- package/dist/index-ByS2IC02.d.ts +51 -0
- package/dist/index-DDSaLjXV.d.cts +25 -0
- package/dist/index-FTrYdHfq.d.cts +1262 -0
- package/dist/index-u3ArUXO0.d.ts +174 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/label-BqmJoVE-.cjs +1 -0
- package/dist/label-XeChe1Bu.js +1 -0
- package/dist/messaging/index.cjs +1 -0
- package/dist/messaging/index.d.cts +1775 -0
- package/dist/messaging/index.d.ts +1775 -0
- package/dist/messaging/index.js +1 -0
- package/dist/misc-BpM_lMTx.js +1 -0
- package/dist/misc-DkqJOm1V.cjs +1 -0
- package/dist/operational-CnxdBwVG.d.cts +13 -0
- package/dist/operational-CnxdBwVG.d.ts +13 -0
- package/dist/redaction-DhuHTlHA.js +124 -0
- package/dist/redaction-DhuHTlHA.js.map +1 -0
- package/dist/redaction-uRIQbTwZ.cjs +171 -0
- package/dist/redaction-uRIQbTwZ.cjs.map +1 -0
- package/dist/rolldown-runtime-auK_WOaK.cjs +1 -0
- package/dist/rolldown-runtime-xuxB8TGW.cjs +32 -0
- package/dist/sdk-B2Lp3JCz.cjs +45 -0
- package/dist/sdk-B2Lp3JCz.cjs.map +1 -0
- package/dist/sdk-IGOHpAeG.js +22 -0
- package/dist/sdk-IGOHpAeG.js.map +1 -0
- package/dist/skills-C1uwr9Pp.js +4 -0
- package/dist/skills-DuE-XnBp.js +1 -0
- package/dist/sso/client.cjs +37 -0
- package/dist/sso/client.cjs.map +1 -0
- package/dist/sso/client.d.cts +89 -0
- package/dist/sso/client.d.ts +89 -0
- package/dist/sso/client.js +36 -0
- package/dist/sso/client.js.map +1 -0
- package/dist/sso/index.cjs +833 -0
- package/dist/sso/index.cjs.map +1 -0
- package/dist/sso/index.d.cts +2 -0
- package/dist/sso/index.d.ts +2 -0
- package/dist/sso/index.js +821 -0
- package/dist/sso/index.js.map +1 -0
- package/dist/sso/nestjs.cjs +169 -0
- package/dist/sso/nestjs.cjs.map +1 -0
- package/dist/sso/nestjs.d.cts +92 -0
- package/dist/sso/nestjs.d.ts +92 -0
- package/dist/sso/nestjs.js +151 -0
- package/dist/sso/nestjs.js.map +1 -0
- package/dist/sso/resource.cjs +124 -0
- package/dist/sso/resource.cjs.map +1 -0
- package/dist/sso/resource.d.cts +3 -0
- package/dist/sso/resource.d.ts +3 -0
- package/dist/sso/resource.js +114 -0
- package/dist/sso/resource.js.map +1 -0
- package/dist/status-CRvlFPIs.js +13 -0
- package/dist/status-CRvlFPIs.js.map +1 -0
- package/dist/status-DtK6OHtj.cjs +24 -0
- package/dist/status-DtK6OHtj.cjs.map +1 -0
- package/dist/telemetry/adapters.cjs +6 -0
- package/dist/telemetry/adapters.d.cts +3 -0
- package/dist/telemetry/adapters.d.ts +3 -0
- package/dist/telemetry/adapters.js +4 -0
- package/dist/telemetry/betterstack.cjs +74 -0
- package/dist/telemetry/betterstack.cjs.map +1 -0
- package/dist/telemetry/betterstack.d.cts +12 -0
- package/dist/telemetry/betterstack.d.ts +12 -0
- package/dist/telemetry/betterstack.js +71 -0
- package/dist/telemetry/betterstack.js.map +1 -0
- package/dist/telemetry/core.cjs +11 -0
- package/dist/telemetry/core.d.cts +4 -0
- package/dist/telemetry/core.d.ts +4 -0
- package/dist/telemetry/core.js +5 -0
- package/dist/telemetry/index.cjs +524 -0
- package/dist/telemetry/index.cjs.map +1 -0
- package/dist/telemetry/index.d.cts +68 -0
- package/dist/telemetry/index.d.ts +68 -0
- package/dist/telemetry/index.js +499 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/posthog.cjs +72 -0
- package/dist/telemetry/posthog.cjs.map +1 -0
- package/dist/telemetry/posthog.d.cts +10 -0
- package/dist/telemetry/posthog.d.ts +10 -0
- package/dist/telemetry/posthog.js +71 -0
- package/dist/telemetry/posthog.js.map +1 -0
- package/dist/telemetry/register.cjs +88 -0
- package/dist/telemetry/register.cjs.map +1 -0
- package/dist/telemetry/register.d.cts +14 -0
- package/dist/telemetry/register.d.ts +14 -0
- package/dist/telemetry/register.js +85 -0
- package/dist/telemetry/register.js.map +1 -0
- package/dist/telemetry/testing.cjs +54 -0
- package/dist/telemetry/testing.cjs.map +1 -0
- package/dist/telemetry/testing.d.cts +15 -0
- package/dist/telemetry/testing.d.ts +15 -0
- package/dist/telemetry/testing.js +52 -0
- package/dist/telemetry/testing.js.map +1 -0
- package/dist/telemetry.mock-BSsx7L6S.cjs +45 -0
- package/dist/telemetry.mock-BSsx7L6S.cjs.map +1 -0
- package/dist/telemetry.mock-BZRpy63c.js +40 -0
- package/dist/telemetry.mock-BZRpy63c.js.map +1 -0
- package/dist/telemetry.mock-C1wXuf-M.d.cts +4 -0
- package/dist/telemetry.mock-CdaxofJ7.d.ts +4 -0
- package/dist/ui/chart.cjs +6 -0
- package/dist/ui/chart.d.cts +34 -0
- package/dist/ui/chart.d.ts +34 -0
- package/dist/ui/chart.js +6 -0
- package/dist/ui/form.cjs +1 -0
- package/dist/ui/form.d.cts +23 -0
- package/dist/ui/form.d.ts +23 -0
- package/dist/ui/form.js +1 -0
- package/dist/ui/hooks.cjs +1 -0
- package/dist/ui/hooks.d.cts +66 -0
- package/dist/ui/hooks.d.ts +66 -0
- package/dist/ui/hooks.js +1 -0
- package/dist/ui/index.cjs +1 -0
- package/dist/ui/index.d.cts +3 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/styles.css +2 -0
- package/dist/ui/utils.cjs +1 -0
- package/dist/ui/utils.d.cts +199 -0
- package/dist/ui/utils.d.ts +199 -0
- package/dist/ui/utils.js +1 -0
- package/dist/use-mobile-BbeIMRgE.cjs +1 -0
- package/dist/use-mobile-Cdd4Lp7p.js +1 -0
- package/dist/use-mobile-ecpyXWz3.d.cts +10 -0
- package/dist/use-mobile-ecpyXWz3.d.ts +10 -0
- package/dist/verifier-BIBtPCVi.cjs +119 -0
- package/dist/verifier-BIBtPCVi.cjs.map +1 -0
- package/dist/verifier-DNdy5Ynw.js +90 -0
- package/dist/verifier-DNdy5Ynw.js.map +1 -0
- package/dist/version-B0ADow60.js +1 -0
- package/dist/version-CMkha8JJ.cjs +1 -0
- package/package.json +539 -5
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
import { decryptOAuthToken } from "better-auth/oauth2";
|
|
2
|
+
/**
|
|
3
|
+
* Contrato público dos webhooks da Conta Rockfeller (ADRs 0029 e 0038).
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Espelha `@sso/jobs` (privado ao monorepo do Accounts); um teste garante que
|
|
7
|
+
* as duas listas de eventos não se separam.
|
|
8
|
+
*/
|
|
9
|
+
declare const WEBHOOK_EVENT_TYPES: readonly ["user.updated", "user.disabled", "user.enabled", "user.deactivated", "user.deleted", "membership.granted", "membership.revoked", "app.access_revoked", "session.ended"];
|
|
10
|
+
declare class WebhookVerificationError extends Error {}
|
|
11
|
+
/**
|
|
12
|
+
* Valida um webhook no formato Standard Webhooks e devolve o envelope.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* HMAC-SHA256 de `id.timestamp.corpo` com a chave do `whsec_…`. Na troca de
|
|
16
|
+
* segredo o cabeçalho traz duas assinaturas; qualquer uma vale. Usa Web
|
|
17
|
+
* Crypto: roda em Node, Bun, Deno e edge.
|
|
18
|
+
*/
|
|
19
|
+
declare function verifyWebhook(secret: string, body: string, headers: Headers, now?: number): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
type: string;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
data: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
|
|
26
|
+
type WebhookUserField = 'name' | 'email' | 'emailVerified' | 'picture' | 'birthdate' | 'phoneNumber' | 'theme' | 'timezone' | 'displayName' | 'reducedMotion' | 'contrast' | 'hourCycle';
|
|
27
|
+
/** A pessoa como o app pode vê-la: os campos dependem dos escopos concedidos. */
|
|
28
|
+
interface WebhookUser {
|
|
29
|
+
sub: string;
|
|
30
|
+
/** Escopo `profile`. */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Escopo `profile`; `null` sem foto. */
|
|
33
|
+
picture?: string | null;
|
|
34
|
+
/** Escopo `email`. */
|
|
35
|
+
email?: string;
|
|
36
|
+
emailVerified?: boolean;
|
|
37
|
+
/** Escopo `birthdate`: `AAAA-MM-DD`, ou `null` sem data. */
|
|
38
|
+
birthdate?: string | null;
|
|
39
|
+
/** Escopo `phone`: WhatsApp verificado em E.164, ou `null` sem número. */
|
|
40
|
+
phoneNumber?: string | null;
|
|
41
|
+
/** Escopo `preferences`: `light`, `dark` ou `system` (o padrão de quem nunca escolheu). */
|
|
42
|
+
theme?: 'light' | 'dark' | 'system';
|
|
43
|
+
/** Escopo `preferences`: fuso do Brasil (IANA), `America/Sao_Paulo` por padrão. */
|
|
44
|
+
timezone?: 'America/Noronha' | 'America/Sao_Paulo' | 'America/Manaus' | 'America/Rio_Branco';
|
|
45
|
+
/** Escopo `preferences`: nome de exibição, ou `null` (use o `name`). */
|
|
46
|
+
displayName?: string | null;
|
|
47
|
+
/** Escopo `preferences`: reduzir animações (`system` segue o aparelho). */
|
|
48
|
+
reducedMotion?: 'system' | 'reduce' | 'no-preference';
|
|
49
|
+
/** Escopo `preferences`: contraste (`system` segue o aparelho). */
|
|
50
|
+
contrast?: 'system' | 'more' | 'default';
|
|
51
|
+
/** Escopo `preferences`: relógio de 12 h, 24 h ou o do aparelho. */
|
|
52
|
+
hourCycle?: 'auto' | '12' | '24';
|
|
53
|
+
/** Versão do retrato: descarte evento com `updatedAt` mais antigo que o último. */
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
}
|
|
56
|
+
interface WebhookMembershipData {
|
|
57
|
+
user: {
|
|
58
|
+
sub: string;
|
|
59
|
+
};
|
|
60
|
+
school: {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
joyUnitId: string | null;
|
|
65
|
+
};
|
|
66
|
+
roles: string[];
|
|
67
|
+
/** Só as permissões do seu app. */
|
|
68
|
+
permissions: string[];
|
|
69
|
+
}
|
|
70
|
+
/** O `data` de cada evento. */
|
|
71
|
+
interface WebhookEventData {
|
|
72
|
+
'user.updated': {
|
|
73
|
+
user: WebhookUser;
|
|
74
|
+
changes: WebhookUserField[];
|
|
75
|
+
};
|
|
76
|
+
'user.disabled': {
|
|
77
|
+
user: {
|
|
78
|
+
sub: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
'user.enabled': {
|
|
82
|
+
user: {
|
|
83
|
+
sub: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
'user.deactivated': {
|
|
87
|
+
user: {
|
|
88
|
+
sub: string;
|
|
89
|
+
};
|
|
90
|
+
/** Quando a conta será anonimizada (ISO 8601). */
|
|
91
|
+
deletionScheduledFor: string;
|
|
92
|
+
};
|
|
93
|
+
'user.deleted': {
|
|
94
|
+
user: {
|
|
95
|
+
sub: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
'membership.granted': WebhookMembershipData;
|
|
99
|
+
'membership.revoked': WebhookMembershipData;
|
|
100
|
+
'app.access_revoked': {
|
|
101
|
+
user: {
|
|
102
|
+
sub: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
'session.ended': {
|
|
106
|
+
user: {
|
|
107
|
+
sub: string;
|
|
108
|
+
};
|
|
109
|
+
/** Sessão no Accounts: o mesmo `sid` do ID token. */
|
|
110
|
+
sid: string;
|
|
111
|
+
endedAt: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Envelope: o corpo do POST. */
|
|
115
|
+
type WebhookEvent<Type extends WebhookEventType = WebhookEventType> = { [K in Type]: {
|
|
116
|
+
/** `evt_…`, igual ao cabeçalho `webhook-id` e entre retentativas. */
|
|
117
|
+
id: string;
|
|
118
|
+
type: K;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
data: WebhookEventData[K];
|
|
121
|
+
}; }[Type];
|
|
122
|
+
/** Conta Rockfeller em produção: o issuer padrão. */
|
|
123
|
+
declare const DEFAULT_ISSUER = "https://accounts.rockfeller.com.br";
|
|
124
|
+
/** Provedor do login no Better Auth do app (`account.providerId`). */
|
|
125
|
+
declare const PROVIDER_ID = "rockfeller";
|
|
126
|
+
/** Provedor que guarda o token de gestão de equipe, vinculado à parte. */
|
|
127
|
+
declare const TEAM_PROVIDER_ID = "rockfeller-team";
|
|
128
|
+
/** Abas de Minha conta no Accounts. */
|
|
129
|
+
declare const PROFILE_TABS: {
|
|
130
|
+
readonly profile: "";
|
|
131
|
+
readonly security: "/security";
|
|
132
|
+
readonly sessions: "/sessions";
|
|
133
|
+
readonly apps: "/apps";
|
|
134
|
+
};
|
|
135
|
+
type ProfileTab = keyof typeof PROFILE_TABS;
|
|
136
|
+
/** Códigos próprios do plugin; os do Accounts passam adiante como vieram. */
|
|
137
|
+
declare const RockfellerErrorCode: {
|
|
138
|
+
/** A pessoa não entrou pela Conta Rockfeller (sem conta `rockfeller`). */
|
|
139
|
+
readonly NOT_CONNECTED: "NOT_CONNECTED";
|
|
140
|
+
/** A gestão de equipe ainda não foi vinculada (`team.connect`). */
|
|
141
|
+
readonly TEAM_NOT_CONNECTED: "TEAM_NOT_CONNECTED";
|
|
142
|
+
/** `team: true` não foi ligado no plugin. */
|
|
143
|
+
readonly TEAM_NOT_ENABLED: "TEAM_NOT_ENABLED";
|
|
144
|
+
/** `api` não foi configurado no plugin. */
|
|
145
|
+
readonly API_NOT_CONFIGURED: "API_NOT_CONFIGURED";
|
|
146
|
+
/** Login por e-mail e senha desligado (`allowLocalSignIn`). */
|
|
147
|
+
readonly LOCAL_SIGN_IN_DISABLED: "LOCAL_SIGN_IN_DISABLED";
|
|
148
|
+
/** Sem a permissão pedida na escola. */
|
|
149
|
+
readonly FORBIDDEN: "FORBIDDEN";
|
|
150
|
+
/** Token ausente, inválido ou expirado. */
|
|
151
|
+
readonly INVALID_TOKEN: "INVALID_TOKEN";
|
|
152
|
+
/** Token trocado (`act`) por um cliente que a API não aceita em nome da pessoa. */
|
|
153
|
+
readonly UNTRUSTED_ACTOR: "UNTRUSTED_ACTOR";
|
|
154
|
+
/** Token de impersonação (um admin vendo como a pessoa) numa API que não o aceita. */
|
|
155
|
+
readonly IMPERSONATION_NOT_ALLOWED: "IMPERSONATION_NOT_ALLOWED";
|
|
156
|
+
/** A impersonação (30 minutos) acabou: entre de novo. */
|
|
157
|
+
readonly IMPERSONATION_EXPIRED: "IMPERSONATION_EXPIRED";
|
|
158
|
+
/** Sessão de impersonação tentando escrever: só leitura. */
|
|
159
|
+
readonly IMPERSONATION_READ_ONLY: "IMPERSONATION_READ_ONLY";
|
|
160
|
+
/** O Accounts não respondeu como esperado. */
|
|
161
|
+
readonly UPSTREAM_FAILED: "UPSTREAM_FAILED";
|
|
162
|
+
/** Chegou um webhook, mas `webhooks` não foi configurado no plugin. */
|
|
163
|
+
readonly WEBHOOKS_NOT_CONFIGURED: "WEBHOOKS_NOT_CONFIGURED";
|
|
164
|
+
/** Webhook sem assinatura válida (segredo errado, corpo alterado ou replay). */
|
|
165
|
+
readonly INVALID_WEBHOOK_SIGNATURE: "INVALID_WEBHOOK_SIGNATURE";
|
|
166
|
+
};
|
|
167
|
+
type RockfellerErrorCode = (typeof RockfellerErrorCode)[keyof typeof RockfellerErrorCode] | (string & {});
|
|
168
|
+
/** Erro do plugin ou do Accounts. Decida pelo `code`, nunca pela mensagem. */
|
|
169
|
+
declare class RockfellerError extends Error {
|
|
170
|
+
readonly code: RockfellerErrorCode;
|
|
171
|
+
readonly status: number;
|
|
172
|
+
readonly name: string;
|
|
173
|
+
constructor(code: RockfellerErrorCode, status: number, message?: string);
|
|
174
|
+
}
|
|
175
|
+
declare function isRockfellerError(error: unknown): error is RockfellerError;
|
|
176
|
+
/** Tema da pessoa na rede toda; `system` segue o aparelho e é o padrão de quem nunca escolheu. */
|
|
177
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
178
|
+
/** Fuso do Brasil (IANA), um por horário. */
|
|
179
|
+
type Timezone = 'America/Noronha' | 'America/Sao_Paulo' | 'America/Manaus' | 'America/Rio_Branco';
|
|
180
|
+
type ReducedMotion = 'system' | 'reduce' | 'no-preference';
|
|
181
|
+
type Contrast = 'system' | 'more' | 'default';
|
|
182
|
+
type HourCycle = 'auto' | '12' | '24';
|
|
183
|
+
/** Preferências da pessoa na rede toda; quem nunca escolheu recebe o padrão de cada uma. */
|
|
184
|
+
interface Preferences {
|
|
185
|
+
theme: Theme;
|
|
186
|
+
/** `America/Sao_Paulo` por padrão. */
|
|
187
|
+
timezone: Timezone;
|
|
188
|
+
/** Como a pessoa quer ser chamada; `null` se não definiu (use o `name`). */
|
|
189
|
+
displayName: string | null;
|
|
190
|
+
reducedMotion: ReducedMotion;
|
|
191
|
+
contrast: Contrast;
|
|
192
|
+
hourCycle: HourCycle;
|
|
193
|
+
}
|
|
194
|
+
/** Só as chaves enviadas mudam; `displayName: null` apaga o nome de exibição. */
|
|
195
|
+
interface PreferencesPatch {
|
|
196
|
+
theme?: Theme | undefined;
|
|
197
|
+
timezone?: Timezone | undefined;
|
|
198
|
+
displayName?: string | null | undefined;
|
|
199
|
+
reducedMotion?: ReducedMotion | undefined;
|
|
200
|
+
contrast?: Contrast | undefined;
|
|
201
|
+
hourCycle?: HourCycle | undefined;
|
|
202
|
+
}
|
|
203
|
+
/** Tipo da organização no Accounts. A franqueadora também aparece como escola. */
|
|
204
|
+
type SchoolType = 'escola' | 'franqueadora';
|
|
205
|
+
/** Uma permissão concedida, no formato `app:recurso.acao`. */
|
|
206
|
+
interface Permission {
|
|
207
|
+
key: string;
|
|
208
|
+
/**
|
|
209
|
+
* Idade máxima do login, em segundos, para usar a permissão. `null` quando
|
|
210
|
+
* não é sensível. Compare com o `authTime` da conta.
|
|
211
|
+
*/
|
|
212
|
+
maxAuthAgeSeconds: number | null;
|
|
213
|
+
}
|
|
214
|
+
interface School {
|
|
215
|
+
id: string;
|
|
216
|
+
name: string;
|
|
217
|
+
type: SchoolType;
|
|
218
|
+
/** Id da unidade no Joy, quando a escola veio de lá. */
|
|
219
|
+
joyUnitId: string | null;
|
|
220
|
+
}
|
|
221
|
+
/** Escola em que a pessoa atua, com os papéis e as permissões dela ali. */
|
|
222
|
+
interface SchoolMembership extends School {
|
|
223
|
+
roles: string[];
|
|
224
|
+
permissions: Permission[];
|
|
225
|
+
}
|
|
226
|
+
interface SchoolList {
|
|
227
|
+
schools: SchoolMembership[];
|
|
228
|
+
/** A pessoa tem `<app>:app.access` em alguma escola. */
|
|
229
|
+
appAccess: boolean;
|
|
230
|
+
accountActive: boolean;
|
|
231
|
+
}
|
|
232
|
+
/** O que a pessoa pode fazer numa escola. */
|
|
233
|
+
interface SchoolPermissions {
|
|
234
|
+
/** `null` quando a escola não existe ou está inativa. */
|
|
235
|
+
school: School | null;
|
|
236
|
+
accountActive: boolean;
|
|
237
|
+
/** Tem vínculo válido com a escola. */
|
|
238
|
+
member: boolean;
|
|
239
|
+
roles: string[];
|
|
240
|
+
permissions: Permission[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Escola por id do Accounts ou pela unidade do Joy.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* 'org_123'
|
|
247
|
+
* { joyUnit: '987' }
|
|
248
|
+
*/
|
|
249
|
+
type SchoolRef = string | {
|
|
250
|
+
joyUnit: string;
|
|
251
|
+
};
|
|
252
|
+
type TeamRoleOrigin = 'joy' | 'invite' | 'franchisor';
|
|
253
|
+
interface TeamRole {
|
|
254
|
+
key: string;
|
|
255
|
+
origin: TeamRoleOrigin;
|
|
256
|
+
grantedAt: string;
|
|
257
|
+
}
|
|
258
|
+
interface TeamMember {
|
|
259
|
+
userId: string;
|
|
260
|
+
name: string;
|
|
261
|
+
email: string;
|
|
262
|
+
status: 'active' | 'pending' | 'disabled';
|
|
263
|
+
roles: TeamRole[];
|
|
264
|
+
}
|
|
265
|
+
interface Page<T> {
|
|
266
|
+
items: T[];
|
|
267
|
+
/** Passe em `cursor` para a próxima página; `null` na última. */
|
|
268
|
+
nextCursor: string | null;
|
|
269
|
+
}
|
|
270
|
+
interface TeamMembersQuery {
|
|
271
|
+
/** Busca por nome ou e-mail. */
|
|
272
|
+
q?: string | undefined;
|
|
273
|
+
role?: string | undefined;
|
|
274
|
+
origin?: TeamRoleOrigin | undefined;
|
|
275
|
+
cursor?: string | undefined;
|
|
276
|
+
limit?: number | undefined;
|
|
277
|
+
}
|
|
278
|
+
/** Papéis que a gestão de equipe pode conceder. */
|
|
279
|
+
type TeamRoleKey = 'coordenador' | 'secretaria' | 'financeiro' | 'gestor_unidade' | 'franqueado' | 'afiliado';
|
|
280
|
+
interface TeamInvitationInput {
|
|
281
|
+
email: string;
|
|
282
|
+
name: string;
|
|
283
|
+
roles: TeamRoleKey[];
|
|
284
|
+
}
|
|
285
|
+
interface TeamInvitation {
|
|
286
|
+
userId: string;
|
|
287
|
+
/** A pessoa não tinha conta: recebeu um e-mail de ativação. */
|
|
288
|
+
accountCreated: boolean;
|
|
289
|
+
granted: string[];
|
|
290
|
+
}
|
|
291
|
+
interface RockfellerOptions {
|
|
292
|
+
/** Client ID do app, cadastrado em Admin → Aplicativos. */
|
|
293
|
+
clientId: string;
|
|
294
|
+
/** Segredo do cliente. Só no servidor. */
|
|
295
|
+
clientSecret: string;
|
|
296
|
+
/**
|
|
297
|
+
* Endereço da Conta Rockfeller.
|
|
298
|
+
* @default 'https://accounts.rockfeller.com.br'
|
|
299
|
+
*/
|
|
300
|
+
issuer?: string | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* URL da API própria do app, cadastrada como recurso protegido. O access
|
|
303
|
+
* token sai com ela no `aud`, e `auth.api.getApiToken` passa a funcionar.
|
|
304
|
+
*/
|
|
305
|
+
api?: string | undefined;
|
|
306
|
+
/**
|
|
307
|
+
* Liga a gestão de equipe: um segundo provedor com o escopo de gestão,
|
|
308
|
+
* vinculado quando o gestor abre a tela (`authClient.rockfeller.team.connect`).
|
|
309
|
+
*/
|
|
310
|
+
team?: boolean | undefined;
|
|
311
|
+
/**
|
|
312
|
+
* Mantém o login por e-mail e senha do próprio app. Por padrão, só a
|
|
313
|
+
* Conta Rockfeller entra.
|
|
314
|
+
* @default false
|
|
315
|
+
*/
|
|
316
|
+
allowLocalSignIn?: boolean | undefined;
|
|
317
|
+
/** Escopos além de `openid profile email offline_access`. */
|
|
318
|
+
scopes?: string[] | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Para onde o Accounts volta depois do logout central. Precisa estar
|
|
321
|
+
* cadastrada no cliente.
|
|
322
|
+
* @default a origem do `baseURL` do app
|
|
323
|
+
*/
|
|
324
|
+
postLogoutRedirect?: string | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* Por quanto tempo guardar as permissões de uma pessoa numa escola. Usa o
|
|
327
|
+
* `secondaryStorage` do app quando houver. `0` desliga.
|
|
328
|
+
* @default 60
|
|
329
|
+
*/
|
|
330
|
+
permissionsCacheSeconds?: number | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* Chamado depois que o back-channel derrubou as sessões da pessoa.
|
|
333
|
+
* @deprecated Use `webhooks.hooks.onSessionEnded`, que recebe o fim de
|
|
334
|
+
* sessão tanto pelo back-channel quanto pelo webhook `session.ended`.
|
|
335
|
+
*/
|
|
336
|
+
onBackchannelLogout?: ((event: {
|
|
337
|
+
sub: string;
|
|
338
|
+
userId: string | null;
|
|
339
|
+
}) => void | Promise<void>) | undefined;
|
|
340
|
+
/**
|
|
341
|
+
* Webhooks da Conta Rockfeller, o jeito recomendado de saber o que mudou
|
|
342
|
+
* (ADR 0038). Cadastre `{baseURL}/webhooks/sso` (ou o `webhooks.path`) em
|
|
343
|
+
* Admin → Aplicativos → Webhooks e guarde o segredo `whsec_…`.
|
|
344
|
+
*/
|
|
345
|
+
webhooks?: RockfellerWebhookOptions | undefined;
|
|
346
|
+
}
|
|
347
|
+
/** O que todo hook de webhook recebe. */
|
|
348
|
+
interface RockfellerWebhookInput<Type extends WebhookEventType> {
|
|
349
|
+
/** A pessoa no Accounts. */
|
|
350
|
+
sub: string;
|
|
351
|
+
/** O usuário local ligado a ela, ou `null` se ela nunca entrou no app. */
|
|
352
|
+
userId: string | null;
|
|
353
|
+
event: WebhookEvent<Type>;
|
|
354
|
+
}
|
|
355
|
+
/** Fim de uma sessão no Accounts, pelo webhook ou pelo back-channel. */
|
|
356
|
+
interface RockfellerSessionEndedInput {
|
|
357
|
+
sub: string;
|
|
358
|
+
userId: string | null;
|
|
359
|
+
/** Sessão no Accounts (`sid` do ID token); `null` se o back-channel não mandou. */
|
|
360
|
+
sid: string | null;
|
|
361
|
+
source: 'webhook' | 'backchannel';
|
|
362
|
+
/** O evento `session.ended`; `null` quando veio pelo back-channel. */
|
|
363
|
+
event: WebhookEvent<'session.ended'> | null;
|
|
364
|
+
}
|
|
365
|
+
type Hook<Input> = ((input: Input) => void | Promise<void>) | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* Um hook por evento. Rodam depois das ações padrão; se um deles lançar, o
|
|
368
|
+
* plugin responde 500 e o Accounts tenta de novo (o mesmo `event.id`): os
|
|
369
|
+
* hooks precisam aguentar o mesmo evento mais de uma vez.
|
|
370
|
+
*/
|
|
371
|
+
interface RockfellerWebhookHooks {
|
|
372
|
+
onSessionEnded?: Hook<RockfellerSessionEndedInput>;
|
|
373
|
+
onUserUpdated?: Hook<RockfellerWebhookInput<'user.updated'>>;
|
|
374
|
+
onUserDisabled?: Hook<RockfellerWebhookInput<'user.disabled'>>;
|
|
375
|
+
onUserEnabled?: Hook<RockfellerWebhookInput<'user.enabled'>>;
|
|
376
|
+
onUserDeactivated?: Hook<RockfellerWebhookInput<'user.deactivated'>>;
|
|
377
|
+
onUserDeleted?: Hook<RockfellerWebhookInput<'user.deleted'>>;
|
|
378
|
+
onMembershipGranted?: Hook<RockfellerWebhookInput<'membership.granted'>>;
|
|
379
|
+
onMembershipRevoked?: Hook<RockfellerWebhookInput<'membership.revoked'>>;
|
|
380
|
+
onAppAccessRevoked?: Hook<RockfellerWebhookInput<'app.access_revoked'>>;
|
|
381
|
+
}
|
|
382
|
+
interface RockfellerWebhookOptions {
|
|
383
|
+
/** Segredo do webhook (`whsec_…`), mostrado uma vez no painel. */
|
|
384
|
+
secret: string;
|
|
385
|
+
/**
|
|
386
|
+
* Rota do endpoint, relativa ao `basePath` do Better Auth.
|
|
387
|
+
* @default '/webhooks/sso'
|
|
388
|
+
*/
|
|
389
|
+
path?: string | undefined;
|
|
390
|
+
/**
|
|
391
|
+
* Ações padrão antes dos hooks: `session.ended` derruba a sessão daquele
|
|
392
|
+
* `sid`; `user.disabled`, `user.deactivated`, `user.deleted` e
|
|
393
|
+
* `app.access_revoked` derrubam todas as sessões da pessoa;
|
|
394
|
+
* `membership.*` limpa o cache de permissões; `user.updated` atualiza
|
|
395
|
+
* nome, e-mail e foto do usuário local. `false` só chama os hooks.
|
|
396
|
+
* @default true
|
|
397
|
+
*/
|
|
398
|
+
defaultActions?: boolean | undefined;
|
|
399
|
+
hooks?: RockfellerWebhookHooks | undefined;
|
|
400
|
+
}
|
|
401
|
+
type AuthContext = Parameters<typeof decryptOAuthToken>[1];
|
|
402
|
+
/**
|
|
403
|
+
* Login com a Conta Rockfeller no Better Auth do app.
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* betterAuth({
|
|
407
|
+
* plugins: [
|
|
408
|
+
* rockfeller({
|
|
409
|
+
* clientId: process.env.ROCKFELLER_CLIENT_ID!,
|
|
410
|
+
* clientSecret: process.env.ROCKFELLER_CLIENT_SECRET!,
|
|
411
|
+
* }),
|
|
412
|
+
* ],
|
|
413
|
+
* });
|
|
414
|
+
*/
|
|
415
|
+
declare function rockfeller(options: RockfellerOptions): {
|
|
416
|
+
id: "rockfeller";
|
|
417
|
+
init: (ctx: AuthContext) => {
|
|
418
|
+
context: {
|
|
419
|
+
socialProviders: import("better-auth").OAuthProvider<object, Partial<import("better-auth").ProviderOptions<object>>>[];
|
|
420
|
+
};
|
|
421
|
+
options: {
|
|
422
|
+
databaseHooks: {
|
|
423
|
+
session: {
|
|
424
|
+
create: {
|
|
425
|
+
before(session: {
|
|
426
|
+
userId: string;
|
|
427
|
+
} & Record<string, unknown>, hookCtx: unknown): Promise<{
|
|
428
|
+
data: {
|
|
429
|
+
rockfellerSid: string;
|
|
430
|
+
userId: string;
|
|
431
|
+
};
|
|
432
|
+
} | undefined>;
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
account: {
|
|
437
|
+
accountLinking: {
|
|
438
|
+
trustedProviders: import("better-auth").LiteralString[];
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
hooks: {
|
|
444
|
+
before: {
|
|
445
|
+
matcher: (ctx: import("better-auth").HookEndpointContext) => boolean;
|
|
446
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
447
|
+
context: {
|
|
448
|
+
body: any;
|
|
449
|
+
};
|
|
450
|
+
}>>;
|
|
451
|
+
}[];
|
|
452
|
+
};
|
|
453
|
+
endpoints: {
|
|
454
|
+
getRockfellerAccount: import("better-call").StrictEndpoint<"/rockfeller/account", {
|
|
455
|
+
method: "GET";
|
|
456
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
457
|
+
session: {
|
|
458
|
+
session: Record<string, any> & {
|
|
459
|
+
id: string;
|
|
460
|
+
createdAt: Date;
|
|
461
|
+
updatedAt: Date;
|
|
462
|
+
userId: string;
|
|
463
|
+
expiresAt: Date;
|
|
464
|
+
token: string;
|
|
465
|
+
ipAddress?: string | null | undefined;
|
|
466
|
+
userAgent?: string | null | undefined;
|
|
467
|
+
};
|
|
468
|
+
user: Record<string, any> & {
|
|
469
|
+
id: string;
|
|
470
|
+
createdAt: Date;
|
|
471
|
+
updatedAt: Date;
|
|
472
|
+
email: string;
|
|
473
|
+
emailVerified: boolean;
|
|
474
|
+
name: string;
|
|
475
|
+
image?: string | null | undefined;
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
}>>[];
|
|
479
|
+
}, {
|
|
480
|
+
sub: string;
|
|
481
|
+
accountId: string;
|
|
482
|
+
authTime: string | null;
|
|
483
|
+
impersonatedBy: string | null;
|
|
484
|
+
}>;
|
|
485
|
+
getApiToken: import("better-call").StrictEndpoint<"/rockfeller/api-token", {
|
|
486
|
+
method: "GET";
|
|
487
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
488
|
+
session: {
|
|
489
|
+
session: Record<string, any> & {
|
|
490
|
+
id: string;
|
|
491
|
+
createdAt: Date;
|
|
492
|
+
updatedAt: Date;
|
|
493
|
+
userId: string;
|
|
494
|
+
expiresAt: Date;
|
|
495
|
+
token: string;
|
|
496
|
+
ipAddress?: string | null | undefined;
|
|
497
|
+
userAgent?: string | null | undefined;
|
|
498
|
+
};
|
|
499
|
+
user: Record<string, any> & {
|
|
500
|
+
id: string;
|
|
501
|
+
createdAt: Date;
|
|
502
|
+
updatedAt: Date;
|
|
503
|
+
email: string;
|
|
504
|
+
emailVerified: boolean;
|
|
505
|
+
name: string;
|
|
506
|
+
image?: string | null | undefined;
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
}>>[];
|
|
510
|
+
metadata: {
|
|
511
|
+
SERVER_ONLY: true;
|
|
512
|
+
};
|
|
513
|
+
}, {
|
|
514
|
+
accessToken: string;
|
|
515
|
+
}>;
|
|
516
|
+
refreshProfile: import("better-call").StrictEndpoint<"/rockfeller/profile/refresh", {
|
|
517
|
+
method: "POST";
|
|
518
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
519
|
+
session: {
|
|
520
|
+
session: Record<string, any> & {
|
|
521
|
+
id: string;
|
|
522
|
+
createdAt: Date;
|
|
523
|
+
updatedAt: Date;
|
|
524
|
+
userId: string;
|
|
525
|
+
expiresAt: Date;
|
|
526
|
+
token: string;
|
|
527
|
+
ipAddress?: string | null | undefined;
|
|
528
|
+
userAgent?: string | null | undefined;
|
|
529
|
+
};
|
|
530
|
+
user: Record<string, any> & {
|
|
531
|
+
id: string;
|
|
532
|
+
createdAt: Date;
|
|
533
|
+
updatedAt: Date;
|
|
534
|
+
email: string;
|
|
535
|
+
emailVerified: boolean;
|
|
536
|
+
name: string;
|
|
537
|
+
image?: string | null | undefined;
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
}>>[];
|
|
541
|
+
}, {
|
|
542
|
+
name: string;
|
|
543
|
+
image: string | null;
|
|
544
|
+
}>;
|
|
545
|
+
getProfileUrl: import("better-call").StrictEndpoint<"/rockfeller/profile/url", {
|
|
546
|
+
method: "GET";
|
|
547
|
+
query: import("zod").ZodObject<{
|
|
548
|
+
returnTo: import("zod").ZodString;
|
|
549
|
+
tab: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
550
|
+
profile: "profile";
|
|
551
|
+
security: "security";
|
|
552
|
+
sessions: "sessions";
|
|
553
|
+
apps: "apps";
|
|
554
|
+
}>>;
|
|
555
|
+
}, import("zod/v4/core").$strip>;
|
|
556
|
+
}, {
|
|
557
|
+
url: string;
|
|
558
|
+
}>;
|
|
559
|
+
listSchools: import("better-call").StrictEndpoint<"/rockfeller/schools", {
|
|
560
|
+
method: "GET";
|
|
561
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
562
|
+
session: {
|
|
563
|
+
session: Record<string, any> & {
|
|
564
|
+
id: string;
|
|
565
|
+
createdAt: Date;
|
|
566
|
+
updatedAt: Date;
|
|
567
|
+
userId: string;
|
|
568
|
+
expiresAt: Date;
|
|
569
|
+
token: string;
|
|
570
|
+
ipAddress?: string | null | undefined;
|
|
571
|
+
userAgent?: string | null | undefined;
|
|
572
|
+
};
|
|
573
|
+
user: Record<string, any> & {
|
|
574
|
+
id: string;
|
|
575
|
+
createdAt: Date;
|
|
576
|
+
updatedAt: Date;
|
|
577
|
+
email: string;
|
|
578
|
+
emailVerified: boolean;
|
|
579
|
+
name: string;
|
|
580
|
+
image?: string | null | undefined;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
}>>[];
|
|
584
|
+
}, SchoolList>;
|
|
585
|
+
getSchoolPermissions: import("better-call").StrictEndpoint<"/rockfeller/schools/permissions", {
|
|
586
|
+
method: "GET";
|
|
587
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
588
|
+
session: {
|
|
589
|
+
session: Record<string, any> & {
|
|
590
|
+
id: string;
|
|
591
|
+
createdAt: Date;
|
|
592
|
+
updatedAt: Date;
|
|
593
|
+
userId: string;
|
|
594
|
+
expiresAt: Date;
|
|
595
|
+
token: string;
|
|
596
|
+
ipAddress?: string | null | undefined;
|
|
597
|
+
userAgent?: string | null | undefined;
|
|
598
|
+
};
|
|
599
|
+
user: Record<string, any> & {
|
|
600
|
+
id: string;
|
|
601
|
+
createdAt: Date;
|
|
602
|
+
updatedAt: Date;
|
|
603
|
+
email: string;
|
|
604
|
+
emailVerified: boolean;
|
|
605
|
+
name: string;
|
|
606
|
+
image?: string | null | undefined;
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
}>>[];
|
|
610
|
+
query: import("zod").ZodObject<{
|
|
611
|
+
school: import("zod").ZodOptional<import("zod").ZodString>;
|
|
612
|
+
joyUnit: import("zod").ZodOptional<import("zod").ZodString>;
|
|
613
|
+
}, import("zod/v4/core").$strip>;
|
|
614
|
+
}, SchoolPermissions>;
|
|
615
|
+
hasPermission: import("better-call").StrictEndpoint<"/rockfeller/permissions/check", {
|
|
616
|
+
method: "POST";
|
|
617
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
618
|
+
session: {
|
|
619
|
+
session: Record<string, any> & {
|
|
620
|
+
id: string;
|
|
621
|
+
createdAt: Date;
|
|
622
|
+
updatedAt: Date;
|
|
623
|
+
userId: string;
|
|
624
|
+
expiresAt: Date;
|
|
625
|
+
token: string;
|
|
626
|
+
ipAddress?: string | null | undefined;
|
|
627
|
+
userAgent?: string | null | undefined;
|
|
628
|
+
};
|
|
629
|
+
user: Record<string, any> & {
|
|
630
|
+
id: string;
|
|
631
|
+
createdAt: Date;
|
|
632
|
+
updatedAt: Date;
|
|
633
|
+
email: string;
|
|
634
|
+
emailVerified: boolean;
|
|
635
|
+
name: string;
|
|
636
|
+
image?: string | null | undefined;
|
|
637
|
+
};
|
|
638
|
+
};
|
|
639
|
+
}>>[];
|
|
640
|
+
body: import("zod").ZodObject<{
|
|
641
|
+
permission: import("zod").ZodString;
|
|
642
|
+
school: import("zod").ZodOptional<import("zod").ZodString>;
|
|
643
|
+
joyUnit: import("zod").ZodOptional<import("zod").ZodString>;
|
|
644
|
+
}, import("zod/v4/core").$strip>;
|
|
645
|
+
metadata: {
|
|
646
|
+
SERVER_ONLY: true;
|
|
647
|
+
};
|
|
648
|
+
}, boolean>;
|
|
649
|
+
requirePermission: import("better-call").StrictEndpoint<"/rockfeller/permissions/require", {
|
|
650
|
+
method: "POST";
|
|
651
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
652
|
+
session: {
|
|
653
|
+
session: Record<string, any> & {
|
|
654
|
+
id: string;
|
|
655
|
+
createdAt: Date;
|
|
656
|
+
updatedAt: Date;
|
|
657
|
+
userId: string;
|
|
658
|
+
expiresAt: Date;
|
|
659
|
+
token: string;
|
|
660
|
+
ipAddress?: string | null | undefined;
|
|
661
|
+
userAgent?: string | null | undefined;
|
|
662
|
+
};
|
|
663
|
+
user: Record<string, any> & {
|
|
664
|
+
id: string;
|
|
665
|
+
createdAt: Date;
|
|
666
|
+
updatedAt: Date;
|
|
667
|
+
email: string;
|
|
668
|
+
emailVerified: boolean;
|
|
669
|
+
name: string;
|
|
670
|
+
image?: string | null | undefined;
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
}>>[];
|
|
674
|
+
body: import("zod").ZodObject<{
|
|
675
|
+
permission: import("zod").ZodString;
|
|
676
|
+
school: import("zod").ZodOptional<import("zod").ZodString>;
|
|
677
|
+
joyUnit: import("zod").ZodOptional<import("zod").ZodString>;
|
|
678
|
+
}, import("zod/v4/core").$strip>;
|
|
679
|
+
metadata: {
|
|
680
|
+
SERVER_ONLY: true;
|
|
681
|
+
};
|
|
682
|
+
}, SchoolPermissions>;
|
|
683
|
+
listTeamMembers: import("better-call").StrictEndpoint<"/rockfeller/team/members", {
|
|
684
|
+
method: "GET";
|
|
685
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
686
|
+
session: {
|
|
687
|
+
session: Record<string, any> & {
|
|
688
|
+
id: string;
|
|
689
|
+
createdAt: Date;
|
|
690
|
+
updatedAt: Date;
|
|
691
|
+
userId: string;
|
|
692
|
+
expiresAt: Date;
|
|
693
|
+
token: string;
|
|
694
|
+
ipAddress?: string | null | undefined;
|
|
695
|
+
userAgent?: string | null | undefined;
|
|
696
|
+
};
|
|
697
|
+
user: Record<string, any> & {
|
|
698
|
+
id: string;
|
|
699
|
+
createdAt: Date;
|
|
700
|
+
updatedAt: Date;
|
|
701
|
+
email: string;
|
|
702
|
+
emailVerified: boolean;
|
|
703
|
+
name: string;
|
|
704
|
+
image?: string | null | undefined;
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
}>>[];
|
|
708
|
+
query: import("zod").ZodObject<{
|
|
709
|
+
school: import("zod").ZodString;
|
|
710
|
+
q: import("zod").ZodOptional<import("zod").ZodString>;
|
|
711
|
+
role: import("zod").ZodOptional<import("zod").ZodString>;
|
|
712
|
+
origin: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
713
|
+
joy: "joy";
|
|
714
|
+
invite: "invite";
|
|
715
|
+
franchisor: "franchisor";
|
|
716
|
+
}>>;
|
|
717
|
+
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
718
|
+
limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
719
|
+
}, import("zod/v4/core").$strip>;
|
|
720
|
+
}, Page<TeamMember>>;
|
|
721
|
+
inviteTeamMember: import("better-call").StrictEndpoint<"/rockfeller/team/invite", {
|
|
722
|
+
method: "POST";
|
|
723
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
724
|
+
session: {
|
|
725
|
+
session: Record<string, any> & {
|
|
726
|
+
id: string;
|
|
727
|
+
createdAt: Date;
|
|
728
|
+
updatedAt: Date;
|
|
729
|
+
userId: string;
|
|
730
|
+
expiresAt: Date;
|
|
731
|
+
token: string;
|
|
732
|
+
ipAddress?: string | null | undefined;
|
|
733
|
+
userAgent?: string | null | undefined;
|
|
734
|
+
};
|
|
735
|
+
user: Record<string, any> & {
|
|
736
|
+
id: string;
|
|
737
|
+
createdAt: Date;
|
|
738
|
+
updatedAt: Date;
|
|
739
|
+
email: string;
|
|
740
|
+
emailVerified: boolean;
|
|
741
|
+
name: string;
|
|
742
|
+
image?: string | null | undefined;
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
}>>[];
|
|
746
|
+
body: import("zod").ZodObject<{
|
|
747
|
+
school: import("zod").ZodString;
|
|
748
|
+
email: import("zod").ZodString;
|
|
749
|
+
name: import("zod").ZodString;
|
|
750
|
+
roles: import("zod").ZodArray<import("zod").ZodEnum<{
|
|
751
|
+
coordenador: "coordenador";
|
|
752
|
+
secretaria: "secretaria";
|
|
753
|
+
financeiro: "financeiro";
|
|
754
|
+
gestor_unidade: "gestor_unidade";
|
|
755
|
+
franqueado: "franqueado";
|
|
756
|
+
afiliado: "afiliado";
|
|
757
|
+
}>>;
|
|
758
|
+
}, import("zod/v4/core").$strip>;
|
|
759
|
+
}, TeamInvitation>;
|
|
760
|
+
revokeTeamRoles: import("better-call").StrictEndpoint<"/rockfeller/team/revoke", {
|
|
761
|
+
method: "POST";
|
|
762
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
763
|
+
session: {
|
|
764
|
+
session: Record<string, any> & {
|
|
765
|
+
id: string;
|
|
766
|
+
createdAt: Date;
|
|
767
|
+
updatedAt: Date;
|
|
768
|
+
userId: string;
|
|
769
|
+
expiresAt: Date;
|
|
770
|
+
token: string;
|
|
771
|
+
ipAddress?: string | null | undefined;
|
|
772
|
+
userAgent?: string | null | undefined;
|
|
773
|
+
};
|
|
774
|
+
user: Record<string, any> & {
|
|
775
|
+
id: string;
|
|
776
|
+
createdAt: Date;
|
|
777
|
+
updatedAt: Date;
|
|
778
|
+
email: string;
|
|
779
|
+
emailVerified: boolean;
|
|
780
|
+
name: string;
|
|
781
|
+
image?: string | null | undefined;
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
}>>[];
|
|
785
|
+
body: import("zod").ZodObject<{
|
|
786
|
+
school: import("zod").ZodString;
|
|
787
|
+
userId: import("zod").ZodString;
|
|
788
|
+
roles: import("zod").ZodArray<import("zod").ZodString>;
|
|
789
|
+
}, import("zod/v4/core").$strip>;
|
|
790
|
+
}, {
|
|
791
|
+
revoked: string[];
|
|
792
|
+
}>;
|
|
793
|
+
rockfellerBackchannelLogout: import("better-call").StrictEndpoint<"/rockfeller/backchannel-logout", {
|
|
794
|
+
method: "POST";
|
|
795
|
+
body: import("zod").ZodObject<{
|
|
796
|
+
logout_token: import("zod").ZodString;
|
|
797
|
+
}, import("zod/v4/core").$strip>;
|
|
798
|
+
metadata: {
|
|
799
|
+
isAction: false;
|
|
800
|
+
allowedMediaTypes: string[];
|
|
801
|
+
};
|
|
802
|
+
}, {
|
|
803
|
+
ok: boolean;
|
|
804
|
+
}>;
|
|
805
|
+
rockfellerWebhooks: import("better-call").StrictEndpoint<`/${string}`, {
|
|
806
|
+
method: "POST";
|
|
807
|
+
disableBody: true;
|
|
808
|
+
metadata: {
|
|
809
|
+
isAction: false;
|
|
810
|
+
};
|
|
811
|
+
}, {
|
|
812
|
+
ok: boolean;
|
|
813
|
+
}>;
|
|
814
|
+
};
|
|
815
|
+
schema: {
|
|
816
|
+
session: {
|
|
817
|
+
fields: {
|
|
818
|
+
rockfellerSid: {
|
|
819
|
+
type: "string";
|
|
820
|
+
required: false;
|
|
821
|
+
input: false;
|
|
822
|
+
};
|
|
823
|
+
};
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
rateLimit: {
|
|
827
|
+
pathMatcher: (path: string) => boolean;
|
|
828
|
+
window: number;
|
|
829
|
+
max: number;
|
|
830
|
+
}[];
|
|
831
|
+
};
|
|
832
|
+
export { isRockfellerError as A, WebhookUser as B, HourCycle as C, Theme as D, ReducedMotion as E, TEAM_PROVIDER_ID as F, WEBHOOK_EVENT_TYPES as H, WebhookEvent as I, WebhookEventData as L, ProfileTab as M, DEFAULT_ISSUER as N, Timezone as O, PROVIDER_ID as P, WebhookEventType as R, Contrast as S, PreferencesPatch as T, WebhookVerificationError as U, WebhookUserField as V, verifyWebhook as W, SchoolList as _, RockfellerWebhookInput as a, SchoolRef as b, TeamInvitation as c, TeamMembersQuery as d, TeamRole as f, School as g, Permission as h, RockfellerWebhookHooks as i, RockfellerErrorCode as j, RockfellerError as k, TeamInvitationInput as l, TeamRoleOrigin as m, RockfellerOptions as n, RockfellerWebhookOptions as o, TeamRoleKey as p, RockfellerSessionEndedInput as r, Page as s, rockfeller as t, TeamMember as u, SchoolMembership as v, Preferences as w, SchoolType as x, SchoolPermissions as y, WebhookMembershipData as z };
|
|
833
|
+
//# sourceMappingURL=index-BDYdEWl2.d.ts.map
|