franchising 0.6.0 → 0.8.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/README.md +13 -72
- package/dist/{accounts-TyMPSHM0.cjs → accounts-BscmRiXc.cjs} +26 -1
- package/dist/{accounts-TyMPSHM0.cjs.map → accounts-BscmRiXc.cjs.map} +1 -1
- package/dist/{accounts-B4bnTXUd.js → accounts-DJRg4gXj.js} +26 -1
- package/dist/{accounts-B4bnTXUd.js.map → accounts-DJRg4gXj.js.map} +1 -1
- package/dist/cli/template-assets/api/src/main.ts +13 -11
- package/dist/cli/template-assets/api/src/modules/health/controller.ts +25 -4
- package/dist/cli/template-assets/api/src/shared/http/errors.ts +17 -0
- package/dist/cli/template-assets/cloudflare/cache.service.ts +1 -0
- package/dist/cli/template-assets/cloudflare/queue.service.ts +1 -0
- package/dist/cli/template-assets/cloudflare/worker.ts +4 -0
- package/dist/cli/template-assets/github/PULL_REQUEST_TEMPLATE.md +37 -0
- package/dist/cli/template-assets/observability/adapters.ts +37 -0
- package/dist/cli/template-assets/observability/bootstrap.ts +48 -0
- package/dist/cli/template-assets/observability/env.ts +21 -0
- package/dist/cli/template-assets/observability/index.ts +10 -0
- package/dist/cli/template-assets/observability/lifecycle.ts +97 -0
- package/dist/cli/template-assets/observability/local-index.ts +9 -0
- package/dist/cli/template-assets/observability/register.ts +12 -0
- package/dist/cli/template-assets/packages/jobs/src/index.ts +4 -40
- package/dist/cli/template-assets/packages/jobs/src/shared/queue/job-id.ts +9 -0
- package/dist/cli/template-assets/packages/jobs/src/shared/queue/options.ts +7 -0
- package/dist/cli/template-assets/packages/jobs/src/shared/queue/prefix.ts +18 -0
- package/dist/cli/template-assets/packages/queue/src/index.ts +4 -0
- package/dist/cli/template-assets/packages/queue/src/shared/errors/failure-reason.ts +7 -0
- package/dist/cli/template-assets/packages/{queue-runtime/src/index.ts → queue/src/shared/redis/connection.ts} +2 -15
- package/dist/cli/template-assets/packages/queue/src/types/redis/connection.ts +6 -0
- package/dist/cli/template-assets/packages/webhooks/src/index.ts +11 -0
- package/dist/cli/template-assets/packages/webhooks/src/shared/crypto/secret.ts +81 -0
- package/dist/cli/template-assets/packages/webhooks/src/shared/signing/headers.ts +43 -0
- package/dist/cli/template-assets/packages/webhooks/src/shared/url/deliverable.ts +58 -0
- package/dist/cli/template-assets/packages/webhooks/src/types/webhooks/job.ts +18 -0
- package/dist/cli/template-assets/packages/webhooks/test/webhooks.test.ts.tpl +69 -0
- package/dist/cli/template-assets/root/dot-dockerignore +88 -8
- package/dist/cli/template-assets/root/dot-oxlintrc.json +22 -0
- package/dist/cli/template-assets/root/lefthook.yml +32 -8
- package/dist/cli/template-assets/web/src/app/(app)/layout.tsx +2 -3
- package/dist/cli/template-assets/web/src/app/(auth)/login/page.tsx +1 -1
- package/dist/cli/template-assets/web/src/app/page.tsx +1 -0
- package/dist/cli/template-assets/web/src/{lib/api-client.ts → shared/api/client.ts} +11 -8
- package/dist/cli/template-assets/web/src/{lib/server-auth.ts → shared/auth/server.ts} +1 -2
- package/dist/cli/template-assets/web/src/types/api.ts +0 -15
- package/dist/cli/template-assets/webhooks/api/src/modules/webhooks/controller.ts +81 -0
- package/dist/cli/template-assets/webhooks/api/src/modules/webhooks/dto/create-endpoint.dto.ts +25 -0
- package/dist/cli/template-assets/webhooks/api/src/modules/webhooks/dto/endpoint.dto.ts +28 -0
- package/dist/cli/template-assets/webhooks/api/src/modules/webhooks/module.ts +27 -0
- package/dist/cli/template-assets/webhooks/api/src/modules/webhooks/repository.ts +147 -0
- package/dist/cli/template-assets/webhooks/api/src/modules/webhooks/service.ts +119 -0
- package/dist/cli/template-assets/webhooks/api/src/types/webhooks/endpoint.ts +26 -0
- package/dist/cli/template-assets/webhooks/worker/src/env.ts +18 -0
- package/dist/cli/template-assets/webhooks/worker/src/modules/queue/dispatcher.ts +119 -0
- package/dist/cli/template-assets/webhooks/worker/src/modules/queue/module.ts +16 -0
- package/dist/cli/template-assets/webhooks/worker/src/modules/queue/processor.ts +176 -0
- package/dist/cli/template-assets/webhooks/worker/src/modules/queue/repository.ts +187 -0
- package/dist/cli/template-assets/webhooks/worker/src/shared/http/deliver.ts +41 -0
- package/dist/cli/template-assets/webhooks/worker/src/types/webhooks/dispatch.ts +26 -0
- package/dist/cli/template-assets/worker/src/app.module.ts +14 -0
- package/dist/cli/template-assets/worker/src/main.ts +24 -0
- package/dist/cli/template-assets/worker/src/modules/queue/processor.ts +26 -3
- package/dist/cli/template-assets/worker/src/modules/queue/retry.ts +22 -7
- package/dist/cli/template-assets/worker/test/retry.test.ts.tpl +13 -1
- package/dist/cli/template-assets/worker-messaging/messaging-api-service.ts +6 -6
- package/dist/cli/template-assets/worker-messaging/src/env.ts +1 -1
- package/dist/cli/template-assets/worker-messaging/src/modules/messaging/service.ts +2 -4
- package/dist/cli/template-assets/worker-messaging/src/modules/queue/module.ts +1 -1
- package/dist/cli/template-assets/worker-messaging/src/modules/queue/processor.ts +32 -10
- package/dist/cli.js +631 -314
- package/dist/{index-CNlb6WNr.d.ts → index-Bl4Ka1Wr.d.ts} +2 -2
- package/dist/{index-I_Nx5SsQ.d.cts → index-CBue43h0.d.cts} +2 -2
- package/dist/{index-B_byXBRW.d.ts → index-cKCKFKLi.d.cts} +181 -5
- package/dist/{index-B_byXBRW.d.cts → index-cKCKFKLi.d.ts} +181 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/messaging/index.cjs +1 -1
- package/dist/messaging/index.d.cts +1 -1
- package/dist/messaging/index.d.ts +1 -1
- package/dist/messaging/index.js +1 -1
- package/dist/sso/client.d.cts +2 -2
- package/dist/sso/client.d.ts +2 -2
- package/dist/sso/index.cjs +72 -1
- package/dist/sso/index.cjs.map +1 -1
- package/dist/sso/index.d.cts +2 -2
- package/dist/sso/index.d.ts +2 -2
- package/dist/sso/index.js +72 -1
- package/dist/sso/index.js.map +1 -1
- package/dist/sso/nestjs.cjs +2 -2
- package/dist/sso/nestjs.d.cts +2 -2
- package/dist/sso/nestjs.d.ts +2 -2
- package/dist/sso/nestjs.js +2 -2
- package/dist/sso/resource.cjs +2 -2
- package/dist/sso/resource.d.cts +3 -3
- package/dist/sso/resource.d.ts +3 -3
- package/dist/sso/resource.js +2 -2
- package/dist/{verifier-BIBtPCVi.cjs → verifier-BYrFb8tg.cjs} +2 -2
- package/dist/{verifier-BIBtPCVi.cjs.map → verifier-BYrFb8tg.cjs.map} +1 -1
- package/dist/{verifier-DNdy5Ynw.js → verifier-DSvtdWuY.js} +2 -2
- package/dist/{verifier-DNdy5Ynw.js.map → verifier-DSvtdWuY.js.map} +1 -1
- package/dist/version-8Zc_uUvG.js +1 -0
- package/dist/{version-DDLRsahz.cjs → version-BMXokpna.cjs} +1 -1
- package/package.json +1 -1
- package/dist/cli/template-assets/api/src/errors/codes.ts +0 -17
- package/dist/cli/template-assets/api/src/errors/index.ts +0 -16
- package/dist/cli/template-assets/api/src/filters/exception.ts +0 -53
- package/dist/cli/template-assets/api/src/shared/exceptions.ts +0 -40
- package/dist/cli/template-assets/api/src/shared/response.ts +0 -31
- package/dist/cli/template-assets/api/src/telemetry.ts +0 -59
- package/dist/version-DHlIo_M1.js +0 -1
- /package/dist/cli/template-assets/web/src/{lib/auth-client.ts → shared/auth/client.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as Preferences$1, C as SchoolList, E as SchoolRef, F as RockfellerError, T as SchoolPermissions, j as PreferencesPatch } from "./index-cKCKFKLi.js";
|
|
2
2
|
import { JWTPayload } from "jose";
|
|
3
3
|
/** Lança 403 `IMPERSONATION_READ_ONLY` se o token é de uma impersonação (só leitura). */
|
|
4
4
|
declare function assertWritable(token: Pick<VerifiedToken, 'readOnly'>): void;
|
|
@@ -171,4 +171,4 @@ declare function createTokenExchanger(options: TokenExchangerOptions): {
|
|
|
171
171
|
exchange(input: TokenExchangeInput): Promise<ExchangedToken>;
|
|
172
172
|
};
|
|
173
173
|
export { assertWritable as _, TokenExchangerOptions as a, Preferences as c, Authorization as d, AuthorizationOptions as f, InvalidTokenError as g, VerifiedToken as h, TokenExchanger as i, PreferencesOptions as l, TokenVerifierOptions as m, ExchangedToken as n, TokenExchangeError as o, TokenVerifier as p, TokenExchangeInput as r, createPreferences as s, createTokenExchanger as t, createAuthorization as u, createTokenVerifier as v };
|
|
174
|
-
//# sourceMappingURL=index-
|
|
174
|
+
//# sourceMappingURL=index-Bl4Ka1Wr.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as Preferences$1, C as SchoolList, E as SchoolRef, F as RockfellerError, T as SchoolPermissions, j as PreferencesPatch } from "./index-cKCKFKLi.cjs";
|
|
2
2
|
import { JWTPayload } from "jose";
|
|
3
3
|
/** Lança 403 `IMPERSONATION_READ_ONLY` se o token é de uma impersonação (só leitura). */
|
|
4
4
|
declare function assertWritable(token: Pick<VerifiedToken, 'readOnly'>): void;
|
|
@@ -171,4 +171,4 @@ declare function createTokenExchanger(options: TokenExchangerOptions): {
|
|
|
171
171
|
exchange(input: TokenExchangeInput): Promise<ExchangedToken>;
|
|
172
172
|
};
|
|
173
173
|
export { assertWritable as _, TokenExchangerOptions as a, Preferences as c, Authorization as d, AuthorizationOptions as f, InvalidTokenError as g, VerifiedToken as h, TokenExchanger as i, PreferencesOptions as l, TokenVerifierOptions as m, ExchangedToken as n, TokenExchangeError as o, TokenVerifier as p, TokenExchangeInput as r, createPreferences as s, createTokenExchanger as t, createAuthorization as u, createTokenVerifier as v };
|
|
174
|
-
//# sourceMappingURL=index-
|
|
174
|
+
//# sourceMappingURL=index-CBue43h0.d.cts.map
|
|
@@ -252,10 +252,11 @@ type SchoolRef = string | {
|
|
|
252
252
|
/**
|
|
253
253
|
* De onde veio o papel: `joy` (sincronização), `invite` (convite da
|
|
254
254
|
* gestão de equipe), `franchisor` (franqueadora), `app` (concedido por um
|
|
255
|
-
* aplicativo)
|
|
256
|
-
*
|
|
255
|
+
* aplicativo com o token dele), `app_admin` (concedido por um admin do app,
|
|
256
|
+
* pelo dashboard) ou `sandbox` (persona de teste, só em apps de
|
|
257
|
+
* desenvolvimento e homologação).
|
|
257
258
|
*/
|
|
258
|
-
type TeamRoleOrigin = 'joy' | 'invite' | 'franchisor' | 'app' | 'sandbox';
|
|
259
|
+
type TeamRoleOrigin = 'joy' | 'invite' | 'franchisor' | 'app' | 'app_admin' | 'sandbox';
|
|
259
260
|
interface TeamRole {
|
|
260
261
|
key: string;
|
|
261
262
|
origin: TeamRoleOrigin;
|
|
@@ -294,6 +295,53 @@ interface TeamInvitation {
|
|
|
294
295
|
accountCreated: boolean;
|
|
295
296
|
granted: string[];
|
|
296
297
|
}
|
|
298
|
+
/** Um papel do app que o admin dele concede. */
|
|
299
|
+
interface AppRole {
|
|
300
|
+
key: string;
|
|
301
|
+
name: string;
|
|
302
|
+
description: string;
|
|
303
|
+
organizationTypes: ('franqueadora' | 'escola')[];
|
|
304
|
+
}
|
|
305
|
+
interface AppRoleList {
|
|
306
|
+
/** Chave do app (o do cliente que emitiu o token). */
|
|
307
|
+
application: string;
|
|
308
|
+
/** Os papéis que cabem na organização, sem o de admin do app. */
|
|
309
|
+
items: AppRole[];
|
|
310
|
+
}
|
|
311
|
+
/** Um papel do app de uma pessoa, uma vez por origem. */
|
|
312
|
+
interface AppRoleGrant {
|
|
313
|
+
key: string;
|
|
314
|
+
origin: TeamRoleOrigin;
|
|
315
|
+
grantedAt: string;
|
|
316
|
+
/** Quem concedeu, quando foi uma pessoa; `null` para o backend do app. */
|
|
317
|
+
grantedBy: {
|
|
318
|
+
userId: string;
|
|
319
|
+
name: string | null;
|
|
320
|
+
} | null;
|
|
321
|
+
}
|
|
322
|
+
interface AppRoleMember {
|
|
323
|
+
userId: string;
|
|
324
|
+
name: string;
|
|
325
|
+
email: string;
|
|
326
|
+
status: 'active' | 'pending' | 'disabled';
|
|
327
|
+
/** Só os papéis do app na organização. */
|
|
328
|
+
roles: AppRoleGrant[];
|
|
329
|
+
}
|
|
330
|
+
interface AppRoleMembersQuery {
|
|
331
|
+
/** Busca por nome ou e-mail. */
|
|
332
|
+
q?: string | undefined;
|
|
333
|
+
/** Só quem tem este papel do app. */
|
|
334
|
+
role?: string | undefined;
|
|
335
|
+
cursor?: string | undefined;
|
|
336
|
+
limit?: number | undefined;
|
|
337
|
+
}
|
|
338
|
+
interface AppRoleInvitationInput {
|
|
339
|
+
email: string;
|
|
340
|
+
/** Só é usado quando a conta é criada agora. */
|
|
341
|
+
name: string;
|
|
342
|
+
/** De 1 a 10 papéis do app (nunca o de admin). */
|
|
343
|
+
roles: string[];
|
|
344
|
+
}
|
|
297
345
|
interface RockfellerOptions {
|
|
298
346
|
/** Client ID do app, cadastrado em Admin → Aplicativos. */
|
|
299
347
|
clientId: string;
|
|
@@ -720,6 +768,7 @@ declare function rockfeller(options: RockfellerOptions): {
|
|
|
720
768
|
invite: "invite";
|
|
721
769
|
franchisor: "franchisor";
|
|
722
770
|
app: "app";
|
|
771
|
+
app_admin: "app_admin";
|
|
723
772
|
sandbox: "sandbox";
|
|
724
773
|
}>>;
|
|
725
774
|
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -798,6 +847,133 @@ declare function rockfeller(options: RockfellerOptions): {
|
|
|
798
847
|
}, {
|
|
799
848
|
revoked: string[];
|
|
800
849
|
}>;
|
|
850
|
+
listAppRoles: import("better-call").StrictEndpoint<"/rockfeller/app-roles", {
|
|
851
|
+
method: "GET";
|
|
852
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
853
|
+
session: {
|
|
854
|
+
session: Record<string, any> & {
|
|
855
|
+
id: string;
|
|
856
|
+
createdAt: Date;
|
|
857
|
+
updatedAt: Date;
|
|
858
|
+
userId: string;
|
|
859
|
+
expiresAt: Date;
|
|
860
|
+
token: string;
|
|
861
|
+
ipAddress?: string | null | undefined;
|
|
862
|
+
userAgent?: string | null | undefined;
|
|
863
|
+
};
|
|
864
|
+
user: Record<string, any> & {
|
|
865
|
+
id: string;
|
|
866
|
+
createdAt: Date;
|
|
867
|
+
updatedAt: Date;
|
|
868
|
+
email: string;
|
|
869
|
+
emailVerified: boolean;
|
|
870
|
+
name: string;
|
|
871
|
+
image?: string | null | undefined;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
}>>[];
|
|
875
|
+
query: import("zod").ZodObject<{
|
|
876
|
+
organization: import("zod").ZodString;
|
|
877
|
+
}, import("zod/v4/core").$strip>;
|
|
878
|
+
}, AppRoleList>;
|
|
879
|
+
listAppRoleMembers: import("better-call").StrictEndpoint<"/rockfeller/app-roles/members", {
|
|
880
|
+
method: "GET";
|
|
881
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
882
|
+
session: {
|
|
883
|
+
session: Record<string, any> & {
|
|
884
|
+
id: string;
|
|
885
|
+
createdAt: Date;
|
|
886
|
+
updatedAt: Date;
|
|
887
|
+
userId: string;
|
|
888
|
+
expiresAt: Date;
|
|
889
|
+
token: string;
|
|
890
|
+
ipAddress?: string | null | undefined;
|
|
891
|
+
userAgent?: string | null | undefined;
|
|
892
|
+
};
|
|
893
|
+
user: Record<string, any> & {
|
|
894
|
+
id: string;
|
|
895
|
+
createdAt: Date;
|
|
896
|
+
updatedAt: Date;
|
|
897
|
+
email: string;
|
|
898
|
+
emailVerified: boolean;
|
|
899
|
+
name: string;
|
|
900
|
+
image?: string | null | undefined;
|
|
901
|
+
};
|
|
902
|
+
};
|
|
903
|
+
}>>[];
|
|
904
|
+
query: import("zod").ZodObject<{
|
|
905
|
+
organization: import("zod").ZodString;
|
|
906
|
+
q: import("zod").ZodOptional<import("zod").ZodString>;
|
|
907
|
+
role: import("zod").ZodOptional<import("zod").ZodString>;
|
|
908
|
+
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
909
|
+
limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
910
|
+
}, import("zod/v4/core").$strip>;
|
|
911
|
+
}, Page<AppRoleMember>>;
|
|
912
|
+
inviteAppRoleMember: import("better-call").StrictEndpoint<"/rockfeller/app-roles/invite", {
|
|
913
|
+
method: "POST";
|
|
914
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
915
|
+
session: {
|
|
916
|
+
session: Record<string, any> & {
|
|
917
|
+
id: string;
|
|
918
|
+
createdAt: Date;
|
|
919
|
+
updatedAt: Date;
|
|
920
|
+
userId: string;
|
|
921
|
+
expiresAt: Date;
|
|
922
|
+
token: string;
|
|
923
|
+
ipAddress?: string | null | undefined;
|
|
924
|
+
userAgent?: string | null | undefined;
|
|
925
|
+
};
|
|
926
|
+
user: Record<string, any> & {
|
|
927
|
+
id: string;
|
|
928
|
+
createdAt: Date;
|
|
929
|
+
updatedAt: Date;
|
|
930
|
+
email: string;
|
|
931
|
+
emailVerified: boolean;
|
|
932
|
+
name: string;
|
|
933
|
+
image?: string | null | undefined;
|
|
934
|
+
};
|
|
935
|
+
};
|
|
936
|
+
}>>[];
|
|
937
|
+
body: import("zod").ZodObject<{
|
|
938
|
+
organization: import("zod").ZodString;
|
|
939
|
+
email: import("zod").ZodString;
|
|
940
|
+
name: import("zod").ZodString;
|
|
941
|
+
roles: import("zod").ZodArray<import("zod").ZodString>;
|
|
942
|
+
}, import("zod/v4/core").$strip>;
|
|
943
|
+
}, TeamInvitation>;
|
|
944
|
+
revokeAppRoles: import("better-call").StrictEndpoint<"/rockfeller/app-roles/revoke", {
|
|
945
|
+
method: "POST";
|
|
946
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
947
|
+
session: {
|
|
948
|
+
session: Record<string, any> & {
|
|
949
|
+
id: string;
|
|
950
|
+
createdAt: Date;
|
|
951
|
+
updatedAt: Date;
|
|
952
|
+
userId: string;
|
|
953
|
+
expiresAt: Date;
|
|
954
|
+
token: string;
|
|
955
|
+
ipAddress?: string | null | undefined;
|
|
956
|
+
userAgent?: string | null | undefined;
|
|
957
|
+
};
|
|
958
|
+
user: Record<string, any> & {
|
|
959
|
+
id: string;
|
|
960
|
+
createdAt: Date;
|
|
961
|
+
updatedAt: Date;
|
|
962
|
+
email: string;
|
|
963
|
+
emailVerified: boolean;
|
|
964
|
+
name: string;
|
|
965
|
+
image?: string | null | undefined;
|
|
966
|
+
};
|
|
967
|
+
};
|
|
968
|
+
}>>[];
|
|
969
|
+
body: import("zod").ZodObject<{
|
|
970
|
+
organization: import("zod").ZodString;
|
|
971
|
+
userId: import("zod").ZodString;
|
|
972
|
+
roles: import("zod").ZodArray<import("zod").ZodString>;
|
|
973
|
+
}, import("zod/v4/core").$strip>;
|
|
974
|
+
}, {
|
|
975
|
+
revoked: string[];
|
|
976
|
+
}>;
|
|
801
977
|
rockfellerBackchannelLogout: import("better-call").StrictEndpoint<"/rockfeller/backchannel-logout", {
|
|
802
978
|
method: "POST";
|
|
803
979
|
body: import("zod").ZodObject<{
|
|
@@ -837,5 +1013,5 @@ declare function rockfeller(options: RockfellerOptions): {
|
|
|
837
1013
|
max: number;
|
|
838
1014
|
}[];
|
|
839
1015
|
};
|
|
840
|
-
export {
|
|
841
|
-
//# sourceMappingURL=index-
|
|
1016
|
+
export { Preferences as A, PROVIDER_ID as B, SchoolList as C, SchoolType as D, SchoolRef as E, RockfellerError as F, WebhookMembershipData as G, WebhookEvent as H, isRockfellerError as I, WEBHOOK_EVENT_TYPES as J, WebhookUser as K, RockfellerErrorCode as L, ReducedMotion as M, Theme as N, Contrast as O, Timezone as P, ProfileTab as R, School as S, SchoolPermissions as T, WebhookEventData as U, TEAM_PROVIDER_ID as V, WebhookEventType as W, verifyWebhook as X, WebhookVerificationError as Y, TeamMembersQuery as _, RockfellerWebhookInput as a, TeamRoleOrigin as b, AppRoleGrant as c, AppRoleMember as d, AppRoleMembersQuery as f, TeamMember as g, TeamInvitationInput as h, RockfellerWebhookHooks as i, PreferencesPatch as j, HourCycle as k, AppRoleInvitationInput as l, TeamInvitation as m, RockfellerOptions as n, RockfellerWebhookOptions as o, Page as p, WebhookUserField as q, RockfellerSessionEndedInput as r, AppRole as s, rockfeller as t, AppRoleList as u, TeamRole as v, SchoolMembership as w, Permission as x, TeamRoleKey as y, DEFAULT_ISSUER as z };
|
|
1017
|
+
//# sourceMappingURL=index-cKCKFKLi.d.cts.map
|
|
@@ -252,10 +252,11 @@ type SchoolRef = string | {
|
|
|
252
252
|
/**
|
|
253
253
|
* De onde veio o papel: `joy` (sincronização), `invite` (convite da
|
|
254
254
|
* gestão de equipe), `franchisor` (franqueadora), `app` (concedido por um
|
|
255
|
-
* aplicativo)
|
|
256
|
-
*
|
|
255
|
+
* aplicativo com o token dele), `app_admin` (concedido por um admin do app,
|
|
256
|
+
* pelo dashboard) ou `sandbox` (persona de teste, só em apps de
|
|
257
|
+
* desenvolvimento e homologação).
|
|
257
258
|
*/
|
|
258
|
-
type TeamRoleOrigin = 'joy' | 'invite' | 'franchisor' | 'app' | 'sandbox';
|
|
259
|
+
type TeamRoleOrigin = 'joy' | 'invite' | 'franchisor' | 'app' | 'app_admin' | 'sandbox';
|
|
259
260
|
interface TeamRole {
|
|
260
261
|
key: string;
|
|
261
262
|
origin: TeamRoleOrigin;
|
|
@@ -294,6 +295,53 @@ interface TeamInvitation {
|
|
|
294
295
|
accountCreated: boolean;
|
|
295
296
|
granted: string[];
|
|
296
297
|
}
|
|
298
|
+
/** Um papel do app que o admin dele concede. */
|
|
299
|
+
interface AppRole {
|
|
300
|
+
key: string;
|
|
301
|
+
name: string;
|
|
302
|
+
description: string;
|
|
303
|
+
organizationTypes: ('franqueadora' | 'escola')[];
|
|
304
|
+
}
|
|
305
|
+
interface AppRoleList {
|
|
306
|
+
/** Chave do app (o do cliente que emitiu o token). */
|
|
307
|
+
application: string;
|
|
308
|
+
/** Os papéis que cabem na organização, sem o de admin do app. */
|
|
309
|
+
items: AppRole[];
|
|
310
|
+
}
|
|
311
|
+
/** Um papel do app de uma pessoa, uma vez por origem. */
|
|
312
|
+
interface AppRoleGrant {
|
|
313
|
+
key: string;
|
|
314
|
+
origin: TeamRoleOrigin;
|
|
315
|
+
grantedAt: string;
|
|
316
|
+
/** Quem concedeu, quando foi uma pessoa; `null` para o backend do app. */
|
|
317
|
+
grantedBy: {
|
|
318
|
+
userId: string;
|
|
319
|
+
name: string | null;
|
|
320
|
+
} | null;
|
|
321
|
+
}
|
|
322
|
+
interface AppRoleMember {
|
|
323
|
+
userId: string;
|
|
324
|
+
name: string;
|
|
325
|
+
email: string;
|
|
326
|
+
status: 'active' | 'pending' | 'disabled';
|
|
327
|
+
/** Só os papéis do app na organização. */
|
|
328
|
+
roles: AppRoleGrant[];
|
|
329
|
+
}
|
|
330
|
+
interface AppRoleMembersQuery {
|
|
331
|
+
/** Busca por nome ou e-mail. */
|
|
332
|
+
q?: string | undefined;
|
|
333
|
+
/** Só quem tem este papel do app. */
|
|
334
|
+
role?: string | undefined;
|
|
335
|
+
cursor?: string | undefined;
|
|
336
|
+
limit?: number | undefined;
|
|
337
|
+
}
|
|
338
|
+
interface AppRoleInvitationInput {
|
|
339
|
+
email: string;
|
|
340
|
+
/** Só é usado quando a conta é criada agora. */
|
|
341
|
+
name: string;
|
|
342
|
+
/** De 1 a 10 papéis do app (nunca o de admin). */
|
|
343
|
+
roles: string[];
|
|
344
|
+
}
|
|
297
345
|
interface RockfellerOptions {
|
|
298
346
|
/** Client ID do app, cadastrado em Admin → Aplicativos. */
|
|
299
347
|
clientId: string;
|
|
@@ -720,6 +768,7 @@ declare function rockfeller(options: RockfellerOptions): {
|
|
|
720
768
|
invite: "invite";
|
|
721
769
|
franchisor: "franchisor";
|
|
722
770
|
app: "app";
|
|
771
|
+
app_admin: "app_admin";
|
|
723
772
|
sandbox: "sandbox";
|
|
724
773
|
}>>;
|
|
725
774
|
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -798,6 +847,133 @@ declare function rockfeller(options: RockfellerOptions): {
|
|
|
798
847
|
}, {
|
|
799
848
|
revoked: string[];
|
|
800
849
|
}>;
|
|
850
|
+
listAppRoles: import("better-call").StrictEndpoint<"/rockfeller/app-roles", {
|
|
851
|
+
method: "GET";
|
|
852
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
853
|
+
session: {
|
|
854
|
+
session: Record<string, any> & {
|
|
855
|
+
id: string;
|
|
856
|
+
createdAt: Date;
|
|
857
|
+
updatedAt: Date;
|
|
858
|
+
userId: string;
|
|
859
|
+
expiresAt: Date;
|
|
860
|
+
token: string;
|
|
861
|
+
ipAddress?: string | null | undefined;
|
|
862
|
+
userAgent?: string | null | undefined;
|
|
863
|
+
};
|
|
864
|
+
user: Record<string, any> & {
|
|
865
|
+
id: string;
|
|
866
|
+
createdAt: Date;
|
|
867
|
+
updatedAt: Date;
|
|
868
|
+
email: string;
|
|
869
|
+
emailVerified: boolean;
|
|
870
|
+
name: string;
|
|
871
|
+
image?: string | null | undefined;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
}>>[];
|
|
875
|
+
query: import("zod").ZodObject<{
|
|
876
|
+
organization: import("zod").ZodString;
|
|
877
|
+
}, import("zod/v4/core").$strip>;
|
|
878
|
+
}, AppRoleList>;
|
|
879
|
+
listAppRoleMembers: import("better-call").StrictEndpoint<"/rockfeller/app-roles/members", {
|
|
880
|
+
method: "GET";
|
|
881
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
882
|
+
session: {
|
|
883
|
+
session: Record<string, any> & {
|
|
884
|
+
id: string;
|
|
885
|
+
createdAt: Date;
|
|
886
|
+
updatedAt: Date;
|
|
887
|
+
userId: string;
|
|
888
|
+
expiresAt: Date;
|
|
889
|
+
token: string;
|
|
890
|
+
ipAddress?: string | null | undefined;
|
|
891
|
+
userAgent?: string | null | undefined;
|
|
892
|
+
};
|
|
893
|
+
user: Record<string, any> & {
|
|
894
|
+
id: string;
|
|
895
|
+
createdAt: Date;
|
|
896
|
+
updatedAt: Date;
|
|
897
|
+
email: string;
|
|
898
|
+
emailVerified: boolean;
|
|
899
|
+
name: string;
|
|
900
|
+
image?: string | null | undefined;
|
|
901
|
+
};
|
|
902
|
+
};
|
|
903
|
+
}>>[];
|
|
904
|
+
query: import("zod").ZodObject<{
|
|
905
|
+
organization: import("zod").ZodString;
|
|
906
|
+
q: import("zod").ZodOptional<import("zod").ZodString>;
|
|
907
|
+
role: import("zod").ZodOptional<import("zod").ZodString>;
|
|
908
|
+
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
909
|
+
limit: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
910
|
+
}, import("zod/v4/core").$strip>;
|
|
911
|
+
}, Page<AppRoleMember>>;
|
|
912
|
+
inviteAppRoleMember: import("better-call").StrictEndpoint<"/rockfeller/app-roles/invite", {
|
|
913
|
+
method: "POST";
|
|
914
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
915
|
+
session: {
|
|
916
|
+
session: Record<string, any> & {
|
|
917
|
+
id: string;
|
|
918
|
+
createdAt: Date;
|
|
919
|
+
updatedAt: Date;
|
|
920
|
+
userId: string;
|
|
921
|
+
expiresAt: Date;
|
|
922
|
+
token: string;
|
|
923
|
+
ipAddress?: string | null | undefined;
|
|
924
|
+
userAgent?: string | null | undefined;
|
|
925
|
+
};
|
|
926
|
+
user: Record<string, any> & {
|
|
927
|
+
id: string;
|
|
928
|
+
createdAt: Date;
|
|
929
|
+
updatedAt: Date;
|
|
930
|
+
email: string;
|
|
931
|
+
emailVerified: boolean;
|
|
932
|
+
name: string;
|
|
933
|
+
image?: string | null | undefined;
|
|
934
|
+
};
|
|
935
|
+
};
|
|
936
|
+
}>>[];
|
|
937
|
+
body: import("zod").ZodObject<{
|
|
938
|
+
organization: import("zod").ZodString;
|
|
939
|
+
email: import("zod").ZodString;
|
|
940
|
+
name: import("zod").ZodString;
|
|
941
|
+
roles: import("zod").ZodArray<import("zod").ZodString>;
|
|
942
|
+
}, import("zod/v4/core").$strip>;
|
|
943
|
+
}, TeamInvitation>;
|
|
944
|
+
revokeAppRoles: import("better-call").StrictEndpoint<"/rockfeller/app-roles/revoke", {
|
|
945
|
+
method: "POST";
|
|
946
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
947
|
+
session: {
|
|
948
|
+
session: Record<string, any> & {
|
|
949
|
+
id: string;
|
|
950
|
+
createdAt: Date;
|
|
951
|
+
updatedAt: Date;
|
|
952
|
+
userId: string;
|
|
953
|
+
expiresAt: Date;
|
|
954
|
+
token: string;
|
|
955
|
+
ipAddress?: string | null | undefined;
|
|
956
|
+
userAgent?: string | null | undefined;
|
|
957
|
+
};
|
|
958
|
+
user: Record<string, any> & {
|
|
959
|
+
id: string;
|
|
960
|
+
createdAt: Date;
|
|
961
|
+
updatedAt: Date;
|
|
962
|
+
email: string;
|
|
963
|
+
emailVerified: boolean;
|
|
964
|
+
name: string;
|
|
965
|
+
image?: string | null | undefined;
|
|
966
|
+
};
|
|
967
|
+
};
|
|
968
|
+
}>>[];
|
|
969
|
+
body: import("zod").ZodObject<{
|
|
970
|
+
organization: import("zod").ZodString;
|
|
971
|
+
userId: import("zod").ZodString;
|
|
972
|
+
roles: import("zod").ZodArray<import("zod").ZodString>;
|
|
973
|
+
}, import("zod/v4/core").$strip>;
|
|
974
|
+
}, {
|
|
975
|
+
revoked: string[];
|
|
976
|
+
}>;
|
|
801
977
|
rockfellerBackchannelLogout: import("better-call").StrictEndpoint<"/rockfeller/backchannel-logout", {
|
|
802
978
|
method: "POST";
|
|
803
979
|
body: import("zod").ZodObject<{
|
|
@@ -837,5 +1013,5 @@ declare function rockfeller(options: RockfellerOptions): {
|
|
|
837
1013
|
max: number;
|
|
838
1014
|
}[];
|
|
839
1015
|
};
|
|
840
|
-
export {
|
|
841
|
-
//# sourceMappingURL=index-
|
|
1016
|
+
export { Preferences as A, PROVIDER_ID as B, SchoolList as C, SchoolType as D, SchoolRef as E, RockfellerError as F, WebhookMembershipData as G, WebhookEvent as H, isRockfellerError as I, WEBHOOK_EVENT_TYPES as J, WebhookUser as K, RockfellerErrorCode as L, ReducedMotion as M, Theme as N, Contrast as O, Timezone as P, ProfileTab as R, School as S, SchoolPermissions as T, WebhookEventData as U, TEAM_PROVIDER_ID as V, WebhookEventType as W, verifyWebhook as X, WebhookVerificationError as Y, TeamMembersQuery as _, RockfellerWebhookInput as a, TeamRoleOrigin as b, AppRoleGrant as c, AppRoleMember as d, AppRoleMembersQuery as f, TeamMember as g, TeamInvitationInput as h, RockfellerWebhookHooks as i, PreferencesPatch as j, HourCycle as k, AppRoleInvitationInput as l, TeamInvitation as m, RockfellerOptions as n, RockfellerWebhookOptions as o, Page as p, WebhookUserField as q, RockfellerSessionEndedInput as r, AppRole as s, rockfeller as t, AppRoleList as u, TeamRole as v, SchoolMembership as w, Permission as x, TeamRoleKey as y, DEFAULT_ISSUER as z };
|
|
1017
|
+
//# sourceMappingURL=index-cKCKFKLi.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./version-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./version-BMXokpna.cjs");exports.version=e.t;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as version}from"./version-
|
|
1
|
+
export{t as version}from"./version-8Zc_uUvG.js";
|
package/dist/messaging/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../version-DDLRsahz.cjs"),t=1048576,n=20*t,r=5*t,i=10*t,a=1024,o=2048,s=[`upload`,`url`],c=[`attachment`,`inline`],l=[`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-powerpoint`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],u=[`application/pdf`,`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`text/csv`,`text/plain`,...l,`application/vnd.oasis.opendocument.text`,`application/vnd.oasis.opendocument.spreadsheet`,`application/zip`,`text/calendar`],d=/* @__PURE__ */ `apk.app.bat.cmd.com.cpl.dll.dmg.exe.hta.jar.js.jse.lnk.msi.msp.pif.ps1.reg.scr.sh.vb.vbe.vbs.wsf.wsh`.split(`.`),f=[`image`,`video`,`audio`,`document`],p={image:[`image/jpeg`,`image/png`],video:[`video/mp4`,`video/3gpp`],audio:[`audio/aac`,`audio/mp4`,`audio/mpeg`,`audio/amr`,`audio/ogg`],document:[`application/pdf`,...l,`text/plain`,`text/csv`,`application/zip`]},m={image:r,video:i,audio:i,document:i},ee=/* @__PURE__ */ `UNAUTHENTICATED.INVALID_API_KEY.ACTIVE_PROJECT_REQUIRED.PROJECT_ROLE_REQUIRED.VALIDATION_ERROR.FROM_DOMAIN_NOT_VERIFIED.SENDER_NOT_FOUND.WHATSAPP_TEMPLATE_NOT_FOUND.WHATSAPP_TEMPLATE_CONFLICT.WHATSAPP_TEMPLATE_PROVIDER_UNSUPPORTED.WHATSAPP_TEMPLATE_SUBMISSION_FAILED.WHATSAPP_TEMPLATE_SYNC_FAILED.WHATSAPP_TEMPLATE_INVALID_STATE.WHATSAPP_TEMPLATE_BODY_CONFLICT.ATTACHMENTS_NOT_SUPPORTED_FOR_CHANNEL.ATTACHMENTS_PROVIDER_TEMPLATE_CONFLICT.ATTACHMENT_INVALID.ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED.ATTACHMENT_TOO_LARGE.ATTACHMENTS_LIMIT_EXCEEDED.ATTACHMENT_URL_NOT_ALLOWED.WHATSAPP_CAPTION_INVALID.PAYLOAD_TOO_LARGE.ATTACHMENT_STORAGE_UNAVAILABLE.ATTACHMENT_STORAGE_NOT_CONFIGURED.ATTACHMENT_EXPIRED.MESSAGE_NOT_FOUND.SUPPRESSION_NOT_FOUND.MESSAGE_NOT_RETRYABLE.MESSAGE_CONTENT_EXPIRED.IDEMPOTENCY_KEY_REUSED.ROUTE_NOT_FOUND.INTERNAL_SERVER_ERROR.RATE_LIMIT_EXCEEDED.CONNECTION_ERROR.TIMEOUT.UNEXPECTED_RESPONSE`.split(`.`);var h=class extends Error{name=`MessagingError`;code;status;errors;constructor(e){super(e.message,{cause:e.cause}),this.code=e.code,this.status=e.status,this.errors=e.errors}get retryable(){return this.status===0||this.status===408||this.status===429||this.status>=500}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this.status,...this.errors?{errors:this.errors}:{}}}},g=class extends h{name=`ValidationError`},_=class extends h{name=`AuthenticationError`},v=class extends h{name=`PermissionError`},y=class extends h{name=`NotFoundError`},b=class extends h{name=`RateLimitError`;retryAfter;constructor(e){super(e),this.retryAfter=e.retryAfter}},x=class extends h{name=`ServerError`},S=class extends h{name=`ConnectionError`},C=class extends h{name=`TimeoutError`};function w(e){return e instanceof h}function T(e){let t={code:e.code,message:e.message,status:e.status,...e.errors?{errors:e.errors}:{}};return e.status===429?new b({...t,...e.retryAfter===void 0?{}:{retryAfter:e.retryAfter}}):e.status>=500?new x(t):e.status===401?new _(t):e.status===403?new v(t):e.status===404?new y(t):e.status===400||e.status===422?new g(t):new h(t)}function te(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)t.append(n,String(e));else t.append(n,r instanceof Date?r.toISOString():String(r))}let n=t.toString();return n?`?${n}`:``}const E=8e3,ne=e=>new Promise(t=>setTimeout(t,e));function re(e,t){if(t!==void 0)return Math.min(t*1e3,E);let n=Math.min(500*2**e,E);return Math.round(n*(.5+Math.random()*.5))}function ie(e){if(!e)return;let t=Number(e);if(Number.isFinite(t)&&t>=0)return t;let n=Date.parse(e);if(!Number.isNaN(n))return Math.max(0,Math.round((n-Date.now())/1e3))}function D(e){if(e.length===1)return e[0];let t=AbortSignal.any;if(t)return t(e);let n=new AbortController;for(let t of e){if(t.aborted){n.abort(t.reason);break}t.addEventListener(`abort`,()=>n.abort(t.reason),{once:!0})}return n.signal}function O(e){return{data:e,error:null}}function k(e){return{data:null,error:e}}const A=e.t,ae=`rockdev-messaging-node/${A}`;var oe=class{config;constructor(e){this.config=e}async request(e){let t=`${this.config.baseUrl}/v1${e.path}${e.query?te(e.query):``}`,n=e.method===`GET`||e.idempotencyKey!==void 0?this.config.maxRetries:0,r;for(let i=0;i<=n;i+=1){let a=await this.attempt(t,e);if(a.error===null)return a;if(r=a.error,!a.error.retryable||e.options?.signal?.aborted||i===n)break;await ne(re(i,a.error.retryAfter))}return k(r)}async attempt(e,t){let n=t.options?.timeout??this.config.timeout,r=new AbortController,i=setTimeout(()=>r.abort(),n),a=[r.signal];t.options?.signal&&a.push(t.options.signal);let o;try{o=await this.config.fetch(e,{method:t.method,headers:this.headers(t),signal:D(a),...t.body===void 0?{}:{body:JSON.stringify(t.body)}})}catch(e){return t.options?.signal?.aborted?k(new h({code:`CONNECTION_ERROR`,message:`The request was aborted by the caller.`,status:0,cause:e})):r.signal.aborted?k(new C({code:`TIMEOUT`,message:`The request did not complete within ${n}ms.`,status:0,cause:e})):k(new S({code:`CONNECTION_ERROR`,message:e instanceof Error?e.message:`The request could not reach the Messaging API.`,status:0,cause:e}))}finally{clearTimeout(i)}return this.parse(o)}headers(e){let t=e=>Object.fromEntries(Object.entries(e).filter(([e])=>e.toLowerCase()!==`idempotency-key`));return{accept:`application/json`,authorization:`Bearer ${this.config.secret}`,"user-agent":ae,...e.body===void 0?{}:{"content-type":`application/json`},...t(this.config.headers),...t(e.options?.headers??{}),...e.idempotencyKey===void 0?{}:{"idempotency-key":e.idempotencyKey}}}async parse(e){let t=await e.text().catch(()=>``),n;try{n=t?JSON.parse(t):void 0}catch{n=void 0}if(!e.ok){let t=ie(e.headers.get(`retry-after`));return k(T({code:n?.code??`INTERNAL_SERVER_ERROR`,message:n?.message??`The Messaging API responded with ${e.status}.`,status:e.status,...n?.errors?{errors:n.errors}:{},...t===void 0?{}:{retryAfter:t}}))}return!n||n.data===void 0?k(new h({code:`UNEXPECTED_RESPONSE`,message:`The Messaging API responded without the expected body.`,status:e.status})):O(n.data)}},j=class{messages;constructor(e){this.messages=e}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:typeof n==`string`?{email:n}:n},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:typeof e==`string`?{email:e}:e})),t)}},M=class e{fetchPage;messages;nextCursor;constructor(e,t){this.fetchPage=t,this.messages=e.messages,this.nextCursor=e.nextCursor}get hasMore(){return this.nextCursor!==null}async next(){return this.nextCursor===null?{data:new e({messages:[],nextCursor:null},this.fetchPage),error:null}:this.fetchPage(this.nextCursor)}async*[Symbol.asyncIterator](){let e=this;for(;;){for(let t of e.messages)yield t;if(!e.hasMore)return;let{data:t,error:n}=await e.next();if(n)throw n;e=t}}};function N(e){if(e!==void 0)return e instanceof Date?e.toISOString():e}function se(e){return{status:e.status,channel:e.channel,to:e.to,search:e.search,scheduled:e.scheduled,createdAfter:N(e.createdAfter),createdBefore:N(e.createdBefore),limit:e.limit,cursor:e.cursor}}const P=24576;function ce(e){if(typeof e.toBase64==`function`)return e.toBase64();let t=globalThis.Buffer;if(t)return t.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`);let n=``;for(let t=0;t<e.length;t+=P){let r=e.subarray(t,t+P),i=``;for(let e=0;e<r.length;e+=1)i+=String.fromCharCode(r[e]);n+=btoa(i)}return n}function le(e){let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return e.length/4*3-t}function ue(e){return typeof Blob<`u`&&e instanceof Blob}function de(e){return`email`in e&&e.email!==void 0?`email`:`whatsapp`in e&&e.whatsapp!==void 0?`whatsapp`:`sms`in e&&e.sms!==void 0?`sms`:`webpush`}function fe(e){return typeof e==`string`?e.includes(`@`)?{email:e}:{whatsapp:e}:e}function F(e){let t=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(e);if(!t)return null;let[n,r]=[Number(t[1]),Number(t[2])];return n===0||n===10||n===127||n===100&&r>=64&&r<=127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===198&&(r===18||r===19)||n>=224}function I(e){if(!e.startsWith(`[`))return null;let t=e.slice(1,-1).toLowerCase(),n=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(t);return n?.[1]?F(n[1])??!0:t===`::`||t===`::1`||t.startsWith(`::ffff:`)||/^f[cd]/.test(t)||/^fe[89ab]/.test(t)||t.startsWith(`ff`)}function L(e){try{return new URL(e)}catch{return null}}const R={pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,csv:`text/csv`,txt:`text/plain`,doc:`application/msword`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,xls:`application/vnd.ms-excel`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,ppt:`application/vnd.ms-powerpoint`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,zip:`application/zip`,ics:`text/calendar`,mp4:`video/mp4`,"3gp":`video/3gpp`,aac:`audio/aac`,m4a:`audio/mp4`,mp3:`audio/mpeg`,amr:`audio/amr`,ogg:`audio/ogg`,opus:`audio/ogg`};function z(e){return(e.split(`;`)[0]??``).trim().toLowerCase()}function B(e){let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?``:e.slice(t+1).toLowerCase()}function V(e){let t=z(e);for(let e of f)if(p[e].includes(t))return e;return null}function pe(e){return R[B(e.trim())]}const me=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*(\s*;.*)?$/i,he=/^[A-Za-z0-9+/]*={0,2}$/,ge=/[/\\\u0000-\u001f\u007f]/;var H=class{code;message;detail;constructor(e,t,n){this.code=e,this.message=t,this.detail=n}};function U(e,t,n=t){throw new H(e,t,n)}function _e(e,t){let n=e=>U(`ATTACHMENT_URL_NOT_ALLOWED`,`The attachment URL is not allowed: ${e}.`,`${t}.url ${e}`);e.length>2048&&n(`must be at most ${o} characters long`);let r=L(e)??n(`must be a valid URL`);r.protocol!==`https:`&&n(`must use https`),(r.username||r.password)&&n(`must not contain credentials`),r.port&&r.port!==`443`&&n(`must use the default port`);let i=r.hostname.toLowerCase().replace(/\.$/,``);(i===`localhost`||i.endsWith(`.localhost`)||i.endsWith(`.local`)||i.endsWith(`.internal`))&&n(`must not point to a local host`),!i.startsWith(`[`)&&!i.includes(`.`)&&n(`must use a fully qualified host name`),(F(i)||I(i))&&n(`must not point to a private address`)}async function ve(e,t){let n=e=>U(`ATTACHMENT_INVALID`,`The attachment is invalid.`,e);typeof e==`object`&&e||n(`${t} must be an object`);let{filename:r,disposition:i,contentId:a}=e;(typeof r!=`string`||r.trim()===``)&&n(`${t}.filename is required`),r.length>255&&n(`${t}.filename must be at most 255 characters long`),ge.test(r)&&n(`${t}.filename must not contain path separators or control characters`);let o=`url`in e&&e.url!==void 0;o===(`content`in e&&e.content!==void 0)&&n(`${t} must have exactly one of url or content`),i!==void 0&&!c.includes(i)&&n(`${t}.disposition must be one of attachment, inline`),a!==void 0&&(typeof a!=`string`||a===``||a.length>255)&&n(`${t}.contentId must be a non-empty string of at most 255 characters`),i===`inline`&&(a??``).trim()===``&&n(`${t}.contentId is required for inline attachments`);let s={...i===void 0?{}:{disposition:i},...a===void 0?{}:{contentId:a}},l=e=>e===void 0||e.trim()===``?n(`${t}.contentType is required`):(me.test(e)||n(`${t}.contentType must be a type/subtype MIME type`),e);if(o){let{url:i}=e;return typeof i==`string`?(_e(i,t),{body:{filename:r,contentType:l(e.contentType),url:i,...s},size:null}):n(`${t}.url must be a string`)}let{content:u}=e,d,f,p;if(typeof u==`string`)u.length%4==0&&he.test(u)||n(`${t}.content must be valid base64`),d=u,f=le(u);else{let e;if(u instanceof Uint8Array)e=u;else if(u instanceof ArrayBuffer)e=new Uint8Array(u);else if(ArrayBuffer.isView(u))e=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);else if(ue(u))p=u.type||void 0,e=new Uint8Array(await u.arrayBuffer());else return n(`${t}.content must be a Uint8Array, ArrayBuffer, Blob or base64 string`);d=ce(e),f=e.byteLength}return{body:{filename:r,contentType:l(e.contentType??p??pe(r)),content:d,...s},size:f}}function ye(e,t,r){if(e===`email`){t.length>10&&U(`ATTACHMENTS_LIMIT_EXCEEDED`,`An email accepts at most 10 attachments.`);let e=0;t.forEach(({body:t,size:n},r)=>{let i=`attachments.${r}`;u.includes(z(t.contentType))||U(`ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED`,`The attachment content type is not allowed for email.`,`${i}.contentType ${z(t.contentType)} is not allowed`),d.includes(B(t.filename.trim()))&&U(`ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED`,`The attachment file extension is not allowed.`,`${i}.filename has a blocked extension`),e+=n??0}),e>20971520&&U(`ATTACHMENT_TOO_LARGE`,`Email attachments must add up to at most ${n} bytes.`);return}t.length>1&&U(`ATTACHMENTS_LIMIT_EXCEEDED`,`A WhatsApp message accepts at most 1 attachment.`);let[i]=t;if(!i)return;let o=`attachments.0`;(i.body.disposition!==void 0||i.body.contentId!==void 0)&&U(`ATTACHMENT_INVALID`,`The attachment is invalid.`,`${o}.disposition and contentId are email-only`);let s=V(i.body.contentType);s||U(`ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED`,`The attachment content type is not allowed for WhatsApp.`,`${o}.contentType ${z(i.body.contentType)} is not allowed`);let c=m[s];i.size!==null&&i.size>c&&U(`ATTACHMENT_TOO_LARGE`,`WhatsApp ${s} attachments must be at most ${c} bytes.`),r!==void 0&&s===`audio`&&U(`WHATSAPP_CAPTION_INVALID`,`WhatsApp audio does not accept a caption.`,`content must be empty for audio attachments`),r!==void 0&&r.length>1024&&U(`WHATSAPP_CAPTION_INVALID`,`A WhatsApp caption must be at most ${a} characters long.`,`content must be at most ${a} characters long`)}async function be(e,t,n=``){try{let n=de(e.to);n!==`email`&&n!==`whatsapp`&&U(`ATTACHMENTS_NOT_SUPPORTED_FOR_CHANNEL`,`Attachments are not supported for the ${n} channel.`),e.providerTemplate!==void 0&&U(`ATTACHMENTS_PROVIDER_TEMPLATE_CONFLICT`,`Attachments cannot be combined with providerTemplate.`),Array.isArray(t)||U(`ATTACHMENT_INVALID`,`The attachment is invalid.`,`attachments must be an array`);let r=[];for(let[e,n]of t.entries())r.push(await ve(n,`attachments.${e}`));return ye(n,r,e.content),O(r.map(({body:e})=>e))}catch(e){if(!(e instanceof H))throw e;return k(new g({code:e.code,message:e.message,status:400,errors:[`${n}${e.detail}`]}))}}function xe(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}async function W(e,t=``){let{to:n,sendAt:r,attachments:i,...a}=e,{idempotencyKey:o,...s}=a,c=fe(n),l;if(i!==void 0&&i.length>0){let e=await be({to:c,content:s.content,providerTemplate:s.providerTemplate},i,t);if(e.error)return k(e.error);l=e.data}return O(xe({...s,to:c,sendAt:N(r),attachments:l}))}var G=class{http;constructor(e){this.http=e}async send(e,t){let n=await W(e);return n.error?k(n.error):this.http.request({method:`POST`,path:`/messages`,body:n.data,...e.idempotencyKey===void 0?{}:{idempotencyKey:e.idempotencyKey},...t?{options:t}:{}})}async batch(e,t){let{idempotencyKey:n,...r}=t??{},i=[];for(let[t,n]of e.entries()){let e=await W(n,`${t}.`);if(e.error)return k(e.error);i.push(e.data)}return this.http.request({method:`POST`,path:`/messages/batch`,body:i,...n===void 0?{}:{idempotencyKey:n},...t?{options:r}:{}})}async create(e,t){return this.send(e,t)}async retry(e,t,n){return this.http.request({method:`POST`,path:`/messages/${encodeURIComponent(e)}/retry`,idempotencyKey:t.idempotencyKey,...n?{options:n}:{}})}async get(e,t){return this.http.request({method:`GET`,path:`/messages/${encodeURIComponent(e)}`,...t?{options:t}:{}})}async retrieve(e,t){return this.get(e,t)}async list(e={},t){let{data:n,error:r}=await this.http.request({method:`GET`,path:`/messages`,query:se(e),...t?{options:t}:{}});return r?{data:null,error:r}:{data:new M(n,n=>this.list({...e,cursor:n},t)),error:null}}},K=class{messages;constructor(e){this.messages=e}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:typeof n==`string`?{sms:n}:n},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:typeof e==`string`?{sms:e}:e})),t)}},q=class{http;constructor(e){this.http=e}create(e,t){return this.http.request({method:`POST`,path:`/suppressions`,body:e,...t?{options:t}:{}})}batch(e,t){return this.http.request({method:`POST`,path:`/suppressions/batch`,body:e,...t?{options:t}:{}})}get(e,t){return this.http.request({method:`GET`,path:`/suppressions/${encodeURIComponent(e)}`,...t?{options:t}:{}})}list(e={},t){return this.http.request({method:`GET`,path:`/suppressions`,query:{email:e.email,reason:e.reason,limit:e.limit,cursor:e.cursor},...t?{options:t}:{}})}delete(e,t){return this.http.request({method:`DELETE`,path:`/suppressions/${encodeURIComponent(e)}`,...t?{options:t}:{}})}batchDelete(e,t){return this.http.request({method:`POST`,path:`/suppressions/batch/delete`,body:e,...t?{options:t}:{}})}},J=class{messages;http;constructor(e,t){this.messages=e,this.http=t}async createSubscriptionToken(e,t){return this.http.request({method:`POST`,path:`/webpush/subscription-tokens`,body:e,...t?{options:t}:{}})}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:{webpush:typeof n==`string`?{recipientId:n}:n}},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:{webpush:typeof e==`string`?{recipientId:e}:e}})),t)}},Y=class{messages;constructor(e){this.messages=e}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:typeof n==`string`?{whatsapp:n}:n},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:typeof e==`string`?{whatsapp:e}:e})),t)}},X=class{http;constructor(e){this.http=e}list(e={},t){return this.http.request({method:`GET`,path:`/whatsapp-templates`,query:{senderId:e.senderId},...t?{options:t}:{}})}get(e,t){return this.http.request({method:`GET`,path:`/whatsapp-templates/${encodeURIComponent(e)}`,...t?{options:t}:{}})}create(e,t){return this.http.request({method:`POST`,path:`/whatsapp-templates`,body:e,...t?{options:t}:{}})}update(e,t,n){return this.http.request({method:`PATCH`,path:`/whatsapp-templates/${encodeURIComponent(e)}`,body:t,...n?{options:n}:{}})}submit(e,t,n){return this.http.request({method:`POST`,path:`/whatsapp-templates/${encodeURIComponent(e)}/submit`,body:t,...n?{options:n}:{}})}sync(e,t){return this.http.request({method:`POST`,path:`/whatsapp-templates/sync`,body:e,...t?{options:t}:{}})}};function Se(e){return(globalThis.process?.env?.[e])?.trim()||void 0}var Z=class{messages;emails;whatsapp;whatsappTemplates;sms;webPush;suppressions;constructor(e){let t=typeof e==`string`?{secret:e}:e,n=t.secret?.trim();if(!n)throw Error("Messaging: `secret` é obrigatório. Use a API key do projeto, por exemplo new Messaging({ secret: process.env.MESSAGING_API_KEY }).");let r=new oe({secret:n,baseUrl:(t.baseUrl??Se(`MESSAGING_BASE_URL`)??`https://api.messaging.rockfeller.com.br`).replace(/\/+$/,``),timeout:t.timeout??3e4,maxRetries:t.maxRetries??2,headers:t.headers??{},fetch:t.fetch??((e,t)=>globalThis.fetch(e,t))});this.messages=new G(r),this.emails=new j(this.messages),this.whatsapp=new Y(this.messages),this.whatsappTemplates=new X(r),this.sms=new K(this.messages),this.webPush=new J(this.messages,r),this.suppressions=new q(r)}};const Ce=[`email`,`whatsapp`,`sms`,`webpush`],we=[`resend`,`unosend`,`twilio`,`meta`,`evolution`],Te=[`normal`,`low`],Ee=[`accepted`,`canceled`,`processing`,`sent`,`delivered`,`complained`,`bounced`,`suppressed`,`failed`],De=[`pending`,`canceled`,`processing`,`sent`,`delivered`,`complained`,`bounced`,`suppressed`,`failed`],Oe=[`delivered`,`complained`],Q=[`bounced`,`suppressed`,`failed`],$=[`canceled`,`delivered`,`complained`,`bounced`,`suppressed`,`failed`];function ke(e){return $.includes(e)}const Ae=[`sent`,`failed`,`unknown`],je=[`email.sent`,`email.delivered`,`email.delivery_delayed`,`email.opened`,`email.clicked`,`email.bounced`,`email.complained`,`email.failed`,`email.suppressed`,`whatsapp.sent`,`whatsapp.delivered`,`whatsapp.read`,`whatsapp.failed`,`sms.sent`,`sms.delivered`,`sms.failed`,`sms.bounced`,`webpush.sent`,`webpush.failed`,`webpush.expired`],Me=[`manual`,`bounce`,`complaint`,`provider_suppressed`],Ne=[`api`,`dashboard`,`automatic`],Pe=[`MARKETING`,`UTILITY`,`AUTHENTICATION`],Fe=[`DRAFT`,`SUBMITTING`,`SUBMISSION_UNKNOWN`,`PENDING`,`APPROVED`,`REJECTED`,`PAUSED`,`DISABLED`,`DELETED`];exports.ATTACHMENT_FILENAME_MAX_LENGTH=255,exports.ATTACHMENT_URL_MAX_LENGTH=o,exports.AuthenticationError=_,exports.BLOCKED_ATTACHMENT_EXTENSIONS=d,exports.ConnectionError=S,exports.DEFAULT_BASE_URL=`https://api.messaging.rockfeller.com.br`,exports.DEFAULT_MAX_RETRIES=2,exports.DEFAULT_TIMEOUT_MS=3e4,exports.EMAIL_ATTACHMENTS_MAX_COUNT=10,exports.EMAIL_ATTACHMENTS_MAX_TOTAL_BYTES=n,exports.EMAIL_ATTACHMENT_CONTENT_TYPES=u,exports.EMAIL_ATTACHMENT_DISPOSITIONS=c,exports.Emails=j,exports.MESSAGE_ATTACHMENT_SOURCES=s,exports.MESSAGE_ATTEMPT_OUTCOMES=Ae,exports.MESSAGE_BATCH_MAX_SIZE=100,exports.MESSAGE_BODY_MAX_BYTES=262144,exports.MESSAGE_DELIVERED_STATUSES=Oe,exports.MESSAGE_DELIVERY_STATUSES=De,exports.MESSAGE_DELIVERY_TERMINAL_STATUSES=$,exports.MESSAGE_EVENT_TYPES=je,exports.MESSAGE_JSON_MAX_BYTES=65536,exports.MESSAGE_LIST_DEFAULT_LIMIT=25,exports.MESSAGE_LIST_MAX_LIMIT=100,exports.MESSAGE_PRIORITIES=Te,exports.MESSAGE_STATUSES=Ee,exports.MESSAGE_SUBJECT_MAX_LENGTH=998,exports.MESSAGE_UNDELIVERED_STATUSES=Q,exports.MESSAGING_ERROR_CODES=ee,exports.Messages=G,exports.MessagesPage=M,exports.Messaging=Z,exports.default=Z,exports.MessagingError=h,exports.NotFoundError=y,exports.PROVIDER_CHANNELS=Ce,exports.PROVIDER_IDS=we,exports.PermissionError=v,exports.RECIPIENT_SUPPRESSED_FAILURE_CODE=`RECIPIENT_SUPPRESSED`,exports.RateLimitError=b,exports.SMS_CONTENT_MAX_LENGTH=1600,exports.SUPPRESSION_BATCH_MAX_SIZE=100,exports.SUPPRESSION_LIST_DEFAULT_LIMIT=50,exports.SUPPRESSION_LIST_MAX_LIMIT=100,exports.SUPPRESSION_NOTE_MAX_LENGTH=500,exports.SUPPRESSION_REASONS=Me,exports.SUPPRESSION_SOURCES=Ne,exports.ServerError=x,exports.Sms=K,exports.Suppressions=q,exports.TimeoutError=C,exports.VERSION=A,exports.ValidationError=g,exports.WHATSAPP_ATTACHMENTS_MAX_COUNT=1,exports.WHATSAPP_CAPTION_MAX_LENGTH=a,exports.WHATSAPP_IMAGE_MAX_BYTES=r,exports.WHATSAPP_MEDIA_KINDS=f,exports.WHATSAPP_MEDIA_MAX_BYTES=i,exports.WHATSAPP_MEDIA_MAX_BYTES_BY_KIND=m,exports.WHATSAPP_MEDIA_TYPES=p,exports.WHATSAPP_TEMPLATE_CATEGORIES=Pe,exports.WHATSAPP_TEMPLATE_STATUSES=Fe,exports.WebPush=J,exports.WhatsApp=Y,exports.WhatsAppTemplates=X,exports.failure=k,exports.isMessagingError=w,exports.isTerminalDeliveryStatus=ke,exports.success=O;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../version-BMXokpna.cjs"),t=1048576,n=20*t,r=5*t,i=10*t,a=1024,o=2048,s=[`upload`,`url`],c=[`attachment`,`inline`],l=[`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-powerpoint`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],u=[`application/pdf`,`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`text/csv`,`text/plain`,...l,`application/vnd.oasis.opendocument.text`,`application/vnd.oasis.opendocument.spreadsheet`,`application/zip`,`text/calendar`],d=/* @__PURE__ */ `apk.app.bat.cmd.com.cpl.dll.dmg.exe.hta.jar.js.jse.lnk.msi.msp.pif.ps1.reg.scr.sh.vb.vbe.vbs.wsf.wsh`.split(`.`),f=[`image`,`video`,`audio`,`document`],p={image:[`image/jpeg`,`image/png`],video:[`video/mp4`,`video/3gpp`],audio:[`audio/aac`,`audio/mp4`,`audio/mpeg`,`audio/amr`,`audio/ogg`],document:[`application/pdf`,...l,`text/plain`,`text/csv`,`application/zip`]},m={image:r,video:i,audio:i,document:i},ee=/* @__PURE__ */ `UNAUTHENTICATED.INVALID_API_KEY.ACTIVE_PROJECT_REQUIRED.PROJECT_ROLE_REQUIRED.VALIDATION_ERROR.FROM_DOMAIN_NOT_VERIFIED.SENDER_NOT_FOUND.WHATSAPP_TEMPLATE_NOT_FOUND.WHATSAPP_TEMPLATE_CONFLICT.WHATSAPP_TEMPLATE_PROVIDER_UNSUPPORTED.WHATSAPP_TEMPLATE_SUBMISSION_FAILED.WHATSAPP_TEMPLATE_SYNC_FAILED.WHATSAPP_TEMPLATE_INVALID_STATE.WHATSAPP_TEMPLATE_BODY_CONFLICT.ATTACHMENTS_NOT_SUPPORTED_FOR_CHANNEL.ATTACHMENTS_PROVIDER_TEMPLATE_CONFLICT.ATTACHMENT_INVALID.ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED.ATTACHMENT_TOO_LARGE.ATTACHMENTS_LIMIT_EXCEEDED.ATTACHMENT_URL_NOT_ALLOWED.WHATSAPP_CAPTION_INVALID.PAYLOAD_TOO_LARGE.ATTACHMENT_STORAGE_UNAVAILABLE.ATTACHMENT_STORAGE_NOT_CONFIGURED.ATTACHMENT_EXPIRED.MESSAGE_NOT_FOUND.SUPPRESSION_NOT_FOUND.MESSAGE_NOT_RETRYABLE.MESSAGE_CONTENT_EXPIRED.IDEMPOTENCY_KEY_REUSED.ROUTE_NOT_FOUND.INTERNAL_SERVER_ERROR.RATE_LIMIT_EXCEEDED.CONNECTION_ERROR.TIMEOUT.UNEXPECTED_RESPONSE`.split(`.`);var h=class extends Error{name=`MessagingError`;code;status;errors;constructor(e){super(e.message,{cause:e.cause}),this.code=e.code,this.status=e.status,this.errors=e.errors}get retryable(){return this.status===0||this.status===408||this.status===429||this.status>=500}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this.status,...this.errors?{errors:this.errors}:{}}}},g=class extends h{name=`ValidationError`},_=class extends h{name=`AuthenticationError`},v=class extends h{name=`PermissionError`},y=class extends h{name=`NotFoundError`},b=class extends h{name=`RateLimitError`;retryAfter;constructor(e){super(e),this.retryAfter=e.retryAfter}},x=class extends h{name=`ServerError`},S=class extends h{name=`ConnectionError`},C=class extends h{name=`TimeoutError`};function w(e){return e instanceof h}function T(e){let t={code:e.code,message:e.message,status:e.status,...e.errors?{errors:e.errors}:{}};return e.status===429?new b({...t,...e.retryAfter===void 0?{}:{retryAfter:e.retryAfter}}):e.status>=500?new x(t):e.status===401?new _(t):e.status===403?new v(t):e.status===404?new y(t):e.status===400||e.status===422?new g(t):new h(t)}function te(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)t.append(n,String(e));else t.append(n,r instanceof Date?r.toISOString():String(r))}let n=t.toString();return n?`?${n}`:``}const E=8e3,ne=e=>new Promise(t=>setTimeout(t,e));function re(e,t){if(t!==void 0)return Math.min(t*1e3,E);let n=Math.min(500*2**e,E);return Math.round(n*(.5+Math.random()*.5))}function ie(e){if(!e)return;let t=Number(e);if(Number.isFinite(t)&&t>=0)return t;let n=Date.parse(e);if(!Number.isNaN(n))return Math.max(0,Math.round((n-Date.now())/1e3))}function D(e){if(e.length===1)return e[0];let t=AbortSignal.any;if(t)return t(e);let n=new AbortController;for(let t of e){if(t.aborted){n.abort(t.reason);break}t.addEventListener(`abort`,()=>n.abort(t.reason),{once:!0})}return n.signal}function O(e){return{data:e,error:null}}function k(e){return{data:null,error:e}}const A=e.t,ae=`rockdev-messaging-node/${A}`;var oe=class{config;constructor(e){this.config=e}async request(e){let t=`${this.config.baseUrl}/v1${e.path}${e.query?te(e.query):``}`,n=e.method===`GET`||e.idempotencyKey!==void 0?this.config.maxRetries:0,r;for(let i=0;i<=n;i+=1){let a=await this.attempt(t,e);if(a.error===null)return a;if(r=a.error,!a.error.retryable||e.options?.signal?.aborted||i===n)break;await ne(re(i,a.error.retryAfter))}return k(r)}async attempt(e,t){let n=t.options?.timeout??this.config.timeout,r=new AbortController,i=setTimeout(()=>r.abort(),n),a=[r.signal];t.options?.signal&&a.push(t.options.signal);let o;try{o=await this.config.fetch(e,{method:t.method,headers:this.headers(t),signal:D(a),...t.body===void 0?{}:{body:JSON.stringify(t.body)}})}catch(e){return t.options?.signal?.aborted?k(new h({code:`CONNECTION_ERROR`,message:`The request was aborted by the caller.`,status:0,cause:e})):r.signal.aborted?k(new C({code:`TIMEOUT`,message:`The request did not complete within ${n}ms.`,status:0,cause:e})):k(new S({code:`CONNECTION_ERROR`,message:e instanceof Error?e.message:`The request could not reach the Messaging API.`,status:0,cause:e}))}finally{clearTimeout(i)}return this.parse(o)}headers(e){let t=e=>Object.fromEntries(Object.entries(e).filter(([e])=>e.toLowerCase()!==`idempotency-key`));return{accept:`application/json`,authorization:`Bearer ${this.config.secret}`,"user-agent":ae,...e.body===void 0?{}:{"content-type":`application/json`},...t(this.config.headers),...t(e.options?.headers??{}),...e.idempotencyKey===void 0?{}:{"idempotency-key":e.idempotencyKey}}}async parse(e){let t=await e.text().catch(()=>``),n;try{n=t?JSON.parse(t):void 0}catch{n=void 0}if(!e.ok){let t=ie(e.headers.get(`retry-after`));return k(T({code:n?.code??`INTERNAL_SERVER_ERROR`,message:n?.message??`The Messaging API responded with ${e.status}.`,status:e.status,...n?.errors?{errors:n.errors}:{},...t===void 0?{}:{retryAfter:t}}))}return!n||n.data===void 0?k(new h({code:`UNEXPECTED_RESPONSE`,message:`The Messaging API responded without the expected body.`,status:e.status})):O(n.data)}},j=class{messages;constructor(e){this.messages=e}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:typeof n==`string`?{email:n}:n},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:typeof e==`string`?{email:e}:e})),t)}},M=class e{fetchPage;messages;nextCursor;constructor(e,t){this.fetchPage=t,this.messages=e.messages,this.nextCursor=e.nextCursor}get hasMore(){return this.nextCursor!==null}async next(){return this.nextCursor===null?{data:new e({messages:[],nextCursor:null},this.fetchPage),error:null}:this.fetchPage(this.nextCursor)}async*[Symbol.asyncIterator](){let e=this;for(;;){for(let t of e.messages)yield t;if(!e.hasMore)return;let{data:t,error:n}=await e.next();if(n)throw n;e=t}}};function N(e){if(e!==void 0)return e instanceof Date?e.toISOString():e}function se(e){return{status:e.status,channel:e.channel,to:e.to,search:e.search,scheduled:e.scheduled,createdAfter:N(e.createdAfter),createdBefore:N(e.createdBefore),limit:e.limit,cursor:e.cursor}}const P=24576;function ce(e){if(typeof e.toBase64==`function`)return e.toBase64();let t=globalThis.Buffer;if(t)return t.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`);let n=``;for(let t=0;t<e.length;t+=P){let r=e.subarray(t,t+P),i=``;for(let e=0;e<r.length;e+=1)i+=String.fromCharCode(r[e]);n+=btoa(i)}return n}function le(e){let t=e.endsWith(`==`)?2:+!!e.endsWith(`=`);return e.length/4*3-t}function ue(e){return typeof Blob<`u`&&e instanceof Blob}function de(e){return`email`in e&&e.email!==void 0?`email`:`whatsapp`in e&&e.whatsapp!==void 0?`whatsapp`:`sms`in e&&e.sms!==void 0?`sms`:`webpush`}function fe(e){return typeof e==`string`?e.includes(`@`)?{email:e}:{whatsapp:e}:e}function F(e){let t=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(e);if(!t)return null;let[n,r]=[Number(t[1]),Number(t[2])];return n===0||n===10||n===127||n===100&&r>=64&&r<=127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===198&&(r===18||r===19)||n>=224}function I(e){if(!e.startsWith(`[`))return null;let t=e.slice(1,-1).toLowerCase(),n=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(t);return n?.[1]?F(n[1])??!0:t===`::`||t===`::1`||t.startsWith(`::ffff:`)||/^f[cd]/.test(t)||/^fe[89ab]/.test(t)||t.startsWith(`ff`)}function L(e){try{return new URL(e)}catch{return null}}const R={pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,csv:`text/csv`,txt:`text/plain`,doc:`application/msword`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,xls:`application/vnd.ms-excel`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,ppt:`application/vnd.ms-powerpoint`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,zip:`application/zip`,ics:`text/calendar`,mp4:`video/mp4`,"3gp":`video/3gpp`,aac:`audio/aac`,m4a:`audio/mp4`,mp3:`audio/mpeg`,amr:`audio/amr`,ogg:`audio/ogg`,opus:`audio/ogg`};function z(e){return(e.split(`;`)[0]??``).trim().toLowerCase()}function B(e){let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?``:e.slice(t+1).toLowerCase()}function V(e){let t=z(e);for(let e of f)if(p[e].includes(t))return e;return null}function pe(e){return R[B(e.trim())]}const me=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*(\s*;.*)?$/i,he=/^[A-Za-z0-9+/]*={0,2}$/,ge=/[/\\\u0000-\u001f\u007f]/;var H=class{code;message;detail;constructor(e,t,n){this.code=e,this.message=t,this.detail=n}};function U(e,t,n=t){throw new H(e,t,n)}function _e(e,t){let n=e=>U(`ATTACHMENT_URL_NOT_ALLOWED`,`The attachment URL is not allowed: ${e}.`,`${t}.url ${e}`);e.length>2048&&n(`must be at most ${o} characters long`);let r=L(e)??n(`must be a valid URL`);r.protocol!==`https:`&&n(`must use https`),(r.username||r.password)&&n(`must not contain credentials`),r.port&&r.port!==`443`&&n(`must use the default port`);let i=r.hostname.toLowerCase().replace(/\.$/,``);(i===`localhost`||i.endsWith(`.localhost`)||i.endsWith(`.local`)||i.endsWith(`.internal`))&&n(`must not point to a local host`),!i.startsWith(`[`)&&!i.includes(`.`)&&n(`must use a fully qualified host name`),(F(i)||I(i))&&n(`must not point to a private address`)}async function ve(e,t){let n=e=>U(`ATTACHMENT_INVALID`,`The attachment is invalid.`,e);typeof e==`object`&&e||n(`${t} must be an object`);let{filename:r,disposition:i,contentId:a}=e;(typeof r!=`string`||r.trim()===``)&&n(`${t}.filename is required`),r.length>255&&n(`${t}.filename must be at most 255 characters long`),ge.test(r)&&n(`${t}.filename must not contain path separators or control characters`);let o=`url`in e&&e.url!==void 0;o===(`content`in e&&e.content!==void 0)&&n(`${t} must have exactly one of url or content`),i!==void 0&&!c.includes(i)&&n(`${t}.disposition must be one of attachment, inline`),a!==void 0&&(typeof a!=`string`||a===``||a.length>255)&&n(`${t}.contentId must be a non-empty string of at most 255 characters`),i===`inline`&&(a??``).trim()===``&&n(`${t}.contentId is required for inline attachments`);let s={...i===void 0?{}:{disposition:i},...a===void 0?{}:{contentId:a}},l=e=>e===void 0||e.trim()===``?n(`${t}.contentType is required`):(me.test(e)||n(`${t}.contentType must be a type/subtype MIME type`),e);if(o){let{url:i}=e;return typeof i==`string`?(_e(i,t),{body:{filename:r,contentType:l(e.contentType),url:i,...s},size:null}):n(`${t}.url must be a string`)}let{content:u}=e,d,f,p;if(typeof u==`string`)u.length%4==0&&he.test(u)||n(`${t}.content must be valid base64`),d=u,f=le(u);else{let e;if(u instanceof Uint8Array)e=u;else if(u instanceof ArrayBuffer)e=new Uint8Array(u);else if(ArrayBuffer.isView(u))e=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);else if(ue(u))p=u.type||void 0,e=new Uint8Array(await u.arrayBuffer());else return n(`${t}.content must be a Uint8Array, ArrayBuffer, Blob or base64 string`);d=ce(e),f=e.byteLength}return{body:{filename:r,contentType:l(e.contentType??p??pe(r)),content:d,...s},size:f}}function ye(e,t,r){if(e===`email`){t.length>10&&U(`ATTACHMENTS_LIMIT_EXCEEDED`,`An email accepts at most 10 attachments.`);let e=0;t.forEach(({body:t,size:n},r)=>{let i=`attachments.${r}`;u.includes(z(t.contentType))||U(`ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED`,`The attachment content type is not allowed for email.`,`${i}.contentType ${z(t.contentType)} is not allowed`),d.includes(B(t.filename.trim()))&&U(`ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED`,`The attachment file extension is not allowed.`,`${i}.filename has a blocked extension`),e+=n??0}),e>20971520&&U(`ATTACHMENT_TOO_LARGE`,`Email attachments must add up to at most ${n} bytes.`);return}t.length>1&&U(`ATTACHMENTS_LIMIT_EXCEEDED`,`A WhatsApp message accepts at most 1 attachment.`);let[i]=t;if(!i)return;let o=`attachments.0`;(i.body.disposition!==void 0||i.body.contentId!==void 0)&&U(`ATTACHMENT_INVALID`,`The attachment is invalid.`,`${o}.disposition and contentId are email-only`);let s=V(i.body.contentType);s||U(`ATTACHMENT_CONTENT_TYPE_NOT_ALLOWED`,`The attachment content type is not allowed for WhatsApp.`,`${o}.contentType ${z(i.body.contentType)} is not allowed`);let c=m[s];i.size!==null&&i.size>c&&U(`ATTACHMENT_TOO_LARGE`,`WhatsApp ${s} attachments must be at most ${c} bytes.`),r!==void 0&&s===`audio`&&U(`WHATSAPP_CAPTION_INVALID`,`WhatsApp audio does not accept a caption.`,`content must be empty for audio attachments`),r!==void 0&&r.length>1024&&U(`WHATSAPP_CAPTION_INVALID`,`A WhatsApp caption must be at most ${a} characters long.`,`content must be at most ${a} characters long`)}async function be(e,t,n=``){try{let n=de(e.to);n!==`email`&&n!==`whatsapp`&&U(`ATTACHMENTS_NOT_SUPPORTED_FOR_CHANNEL`,`Attachments are not supported for the ${n} channel.`),e.providerTemplate!==void 0&&U(`ATTACHMENTS_PROVIDER_TEMPLATE_CONFLICT`,`Attachments cannot be combined with providerTemplate.`),Array.isArray(t)||U(`ATTACHMENT_INVALID`,`The attachment is invalid.`,`attachments must be an array`);let r=[];for(let[e,n]of t.entries())r.push(await ve(n,`attachments.${e}`));return ye(n,r,e.content),O(r.map(({body:e})=>e))}catch(e){if(!(e instanceof H))throw e;return k(new g({code:e.code,message:e.message,status:400,errors:[`${n}${e.detail}`]}))}}function xe(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}async function W(e,t=``){let{to:n,sendAt:r,attachments:i,...a}=e,{idempotencyKey:o,...s}=a,c=fe(n),l;if(i!==void 0&&i.length>0){let e=await be({to:c,content:s.content,providerTemplate:s.providerTemplate},i,t);if(e.error)return k(e.error);l=e.data}return O(xe({...s,to:c,sendAt:N(r),attachments:l}))}var G=class{http;constructor(e){this.http=e}async send(e,t){let n=await W(e);return n.error?k(n.error):this.http.request({method:`POST`,path:`/messages`,body:n.data,...e.idempotencyKey===void 0?{}:{idempotencyKey:e.idempotencyKey},...t?{options:t}:{}})}async batch(e,t){let{idempotencyKey:n,...r}=t??{},i=[];for(let[t,n]of e.entries()){let e=await W(n,`${t}.`);if(e.error)return k(e.error);i.push(e.data)}return this.http.request({method:`POST`,path:`/messages/batch`,body:i,...n===void 0?{}:{idempotencyKey:n},...t?{options:r}:{}})}async create(e,t){return this.send(e,t)}async retry(e,t,n){return this.http.request({method:`POST`,path:`/messages/${encodeURIComponent(e)}/retry`,idempotencyKey:t.idempotencyKey,...n?{options:n}:{}})}async get(e,t){return this.http.request({method:`GET`,path:`/messages/${encodeURIComponent(e)}`,...t?{options:t}:{}})}async retrieve(e,t){return this.get(e,t)}async list(e={},t){let{data:n,error:r}=await this.http.request({method:`GET`,path:`/messages`,query:se(e),...t?{options:t}:{}});return r?{data:null,error:r}:{data:new M(n,n=>this.list({...e,cursor:n},t)),error:null}}},K=class{messages;constructor(e){this.messages=e}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:typeof n==`string`?{sms:n}:n},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:typeof e==`string`?{sms:e}:e})),t)}},q=class{http;constructor(e){this.http=e}create(e,t){return this.http.request({method:`POST`,path:`/suppressions`,body:e,...t?{options:t}:{}})}batch(e,t){return this.http.request({method:`POST`,path:`/suppressions/batch`,body:e,...t?{options:t}:{}})}get(e,t){return this.http.request({method:`GET`,path:`/suppressions/${encodeURIComponent(e)}`,...t?{options:t}:{}})}list(e={},t){return this.http.request({method:`GET`,path:`/suppressions`,query:{email:e.email,reason:e.reason,limit:e.limit,cursor:e.cursor},...t?{options:t}:{}})}delete(e,t){return this.http.request({method:`DELETE`,path:`/suppressions/${encodeURIComponent(e)}`,...t?{options:t}:{}})}batchDelete(e,t){return this.http.request({method:`POST`,path:`/suppressions/batch/delete`,body:e,...t?{options:t}:{}})}},J=class{messages;http;constructor(e,t){this.messages=e,this.http=t}async createSubscriptionToken(e,t){return this.http.request({method:`POST`,path:`/webpush/subscription-tokens`,body:e,...t?{options:t}:{}})}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:{webpush:typeof n==`string`?{recipientId:n}:n}},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:{webpush:typeof e==`string`?{recipientId:e}:e}})),t)}},Y=class{messages;constructor(e){this.messages=e}async send(e,t){let{to:n,...r}=e;return this.messages.send({...r,to:typeof n==`string`?{whatsapp:n}:n},t)}async batch(e,t){return this.messages.batch(e.map(({to:e,...t})=>({...t,to:typeof e==`string`?{whatsapp:e}:e})),t)}},X=class{http;constructor(e){this.http=e}list(e={},t){return this.http.request({method:`GET`,path:`/whatsapp-templates`,query:{senderId:e.senderId},...t?{options:t}:{}})}get(e,t){return this.http.request({method:`GET`,path:`/whatsapp-templates/${encodeURIComponent(e)}`,...t?{options:t}:{}})}create(e,t){return this.http.request({method:`POST`,path:`/whatsapp-templates`,body:e,...t?{options:t}:{}})}update(e,t,n){return this.http.request({method:`PATCH`,path:`/whatsapp-templates/${encodeURIComponent(e)}`,body:t,...n?{options:n}:{}})}submit(e,t,n){return this.http.request({method:`POST`,path:`/whatsapp-templates/${encodeURIComponent(e)}/submit`,body:t,...n?{options:n}:{}})}sync(e,t){return this.http.request({method:`POST`,path:`/whatsapp-templates/sync`,body:e,...t?{options:t}:{}})}};function Se(e){return(globalThis.process?.env?.[e])?.trim()||void 0}var Z=class{messages;emails;whatsapp;whatsappTemplates;sms;webPush;suppressions;constructor(e){let t=typeof e==`string`?{secret:e}:e,n=t.secret?.trim();if(!n)throw Error("Messaging: `secret` é obrigatório. Use a API key do projeto, por exemplo new Messaging({ secret: process.env.MESSAGING_API_KEY }).");let r=new oe({secret:n,baseUrl:(t.baseUrl??Se(`MESSAGING_BASE_URL`)??`https://api.messaging.rockfeller.com.br`).replace(/\/+$/,``),timeout:t.timeout??3e4,maxRetries:t.maxRetries??2,headers:t.headers??{},fetch:t.fetch??((e,t)=>globalThis.fetch(e,t))});this.messages=new G(r),this.emails=new j(this.messages),this.whatsapp=new Y(this.messages),this.whatsappTemplates=new X(r),this.sms=new K(this.messages),this.webPush=new J(this.messages,r),this.suppressions=new q(r)}};const Ce=[`email`,`whatsapp`,`sms`,`webpush`],we=[`resend`,`unosend`,`twilio`,`meta`,`evolution`],Te=[`normal`,`low`],Ee=[`accepted`,`canceled`,`processing`,`sent`,`delivered`,`complained`,`bounced`,`suppressed`,`failed`],De=[`pending`,`canceled`,`processing`,`sent`,`delivered`,`complained`,`bounced`,`suppressed`,`failed`],Oe=[`delivered`,`complained`],Q=[`bounced`,`suppressed`,`failed`],$=[`canceled`,`delivered`,`complained`,`bounced`,`suppressed`,`failed`];function ke(e){return $.includes(e)}const Ae=[`sent`,`failed`,`unknown`],je=[`email.sent`,`email.delivered`,`email.delivery_delayed`,`email.opened`,`email.clicked`,`email.bounced`,`email.complained`,`email.failed`,`email.suppressed`,`whatsapp.sent`,`whatsapp.delivered`,`whatsapp.read`,`whatsapp.failed`,`sms.sent`,`sms.delivered`,`sms.failed`,`sms.bounced`,`webpush.sent`,`webpush.failed`,`webpush.expired`],Me=[`manual`,`bounce`,`complaint`,`provider_suppressed`],Ne=[`api`,`dashboard`,`automatic`],Pe=[`MARKETING`,`UTILITY`,`AUTHENTICATION`],Fe=[`DRAFT`,`SUBMITTING`,`SUBMISSION_UNKNOWN`,`PENDING`,`APPROVED`,`REJECTED`,`PAUSED`,`DISABLED`,`DELETED`];exports.ATTACHMENT_FILENAME_MAX_LENGTH=255,exports.ATTACHMENT_URL_MAX_LENGTH=o,exports.AuthenticationError=_,exports.BLOCKED_ATTACHMENT_EXTENSIONS=d,exports.ConnectionError=S,exports.DEFAULT_BASE_URL=`https://api.messaging.rockfeller.com.br`,exports.DEFAULT_MAX_RETRIES=2,exports.DEFAULT_TIMEOUT_MS=3e4,exports.EMAIL_ATTACHMENTS_MAX_COUNT=10,exports.EMAIL_ATTACHMENTS_MAX_TOTAL_BYTES=n,exports.EMAIL_ATTACHMENT_CONTENT_TYPES=u,exports.EMAIL_ATTACHMENT_DISPOSITIONS=c,exports.Emails=j,exports.MESSAGE_ATTACHMENT_SOURCES=s,exports.MESSAGE_ATTEMPT_OUTCOMES=Ae,exports.MESSAGE_BATCH_MAX_SIZE=100,exports.MESSAGE_BODY_MAX_BYTES=262144,exports.MESSAGE_DELIVERED_STATUSES=Oe,exports.MESSAGE_DELIVERY_STATUSES=De,exports.MESSAGE_DELIVERY_TERMINAL_STATUSES=$,exports.MESSAGE_EVENT_TYPES=je,exports.MESSAGE_JSON_MAX_BYTES=65536,exports.MESSAGE_LIST_DEFAULT_LIMIT=25,exports.MESSAGE_LIST_MAX_LIMIT=100,exports.MESSAGE_PRIORITIES=Te,exports.MESSAGE_STATUSES=Ee,exports.MESSAGE_SUBJECT_MAX_LENGTH=998,exports.MESSAGE_UNDELIVERED_STATUSES=Q,exports.MESSAGING_ERROR_CODES=ee,exports.Messages=G,exports.MessagesPage=M,exports.Messaging=Z,exports.default=Z,exports.MessagingError=h,exports.NotFoundError=y,exports.PROVIDER_CHANNELS=Ce,exports.PROVIDER_IDS=we,exports.PermissionError=v,exports.RECIPIENT_SUPPRESSED_FAILURE_CODE=`RECIPIENT_SUPPRESSED`,exports.RateLimitError=b,exports.SMS_CONTENT_MAX_LENGTH=1600,exports.SUPPRESSION_BATCH_MAX_SIZE=100,exports.SUPPRESSION_LIST_DEFAULT_LIMIT=50,exports.SUPPRESSION_LIST_MAX_LIMIT=100,exports.SUPPRESSION_NOTE_MAX_LENGTH=500,exports.SUPPRESSION_REASONS=Me,exports.SUPPRESSION_SOURCES=Ne,exports.ServerError=x,exports.Sms=K,exports.Suppressions=q,exports.TimeoutError=C,exports.VERSION=A,exports.ValidationError=g,exports.WHATSAPP_ATTACHMENTS_MAX_COUNT=1,exports.WHATSAPP_CAPTION_MAX_LENGTH=a,exports.WHATSAPP_IMAGE_MAX_BYTES=r,exports.WHATSAPP_MEDIA_KINDS=f,exports.WHATSAPP_MEDIA_MAX_BYTES=i,exports.WHATSAPP_MEDIA_MAX_BYTES_BY_KIND=m,exports.WHATSAPP_MEDIA_TYPES=p,exports.WHATSAPP_TEMPLATE_CATEGORIES=Pe,exports.WHATSAPP_TEMPLATE_STATUSES=Fe,exports.WebPush=J,exports.WhatsApp=Y,exports.WhatsAppTemplates=X,exports.failure=k,exports.isMessagingError=w,exports.isTerminalDeliveryStatus=ke,exports.success=O;
|
|
@@ -1914,5 +1914,5 @@ export declare const SUPPRESSION_NOTE_MAX_LENGTH = 500;
|
|
|
1914
1914
|
/** Limite do `subject`, em caracteres. */
|
|
1915
1915
|
export declare const MESSAGE_SUBJECT_MAX_LENGTH = 998;
|
|
1916
1916
|
/** Versão do pacote `franchising`, a mesma do `package.json`. */
|
|
1917
|
-
export declare const VERSION = "0.
|
|
1917
|
+
export declare const VERSION = "0.8.0";
|
|
1918
1918
|
export { type AcceptedBatchMessage, type AcceptedDelivery, type AcceptedMessage, type AcceptedMessageRetry, type AcceptedWebPushDelivery, type AttachmentContent, type AttachmentContentInput, type AttachmentInput, type AttachmentUrlInput, type BatchCreateSuppressionsOptions, type BatchCreateSuppressionsPayload, type BatchDeleteSuppressionsOptions, type BatchDeleteSuppressionsPayload, type BatchRequestOptions, type BatchSendEmailInput, type BatchSendMessageOptions, type BatchSendSmsInput, type BatchSendWebPushInput, type BatchSendWhatsAppInput, type CreateSuppressionOptions, type CreateWebPushSubscriptionTokenInput, type CreateWhatsAppTemplateOptions, type DeletedSuppression, type EmailAttachmentDisposition, type EmailAttachmentInput, type EmailAttachmentOptions, type EmailDestination, type FetchLike, type IsoDateTime, type JsonObject, type ListMessagesOptions, type ListSuppressionsOptions, type ListedMessage, type ListedMessageChannel, type LooseString, type Message, type MessageAttachment, type MessageAttachmentSource, type MessageAttempt, type MessageAttemptOutcome, type MessageChannel, type MessageDeliveryStatus, type MessageDestination, type MessageEvent, type MessageEventType, type MessageListPayload, type MessagePriority, type MessageRetry, type MessageStatus, Messaging as default, type MessagingConfig, type MessagingErrorCode, type MessagingErrorOptions, type ProviderChannel, type ProviderId, type RequestOptions, type Result, type RetryMessageOptions, type SendEmailInput, type SendEmailOptions, type SendMessageOptions, type SendSmsInput, type SendSmsOptions, type SendWebPushInput, type SendWebPushOptions, type SendWhatsAppInput, type SendWhatsAppOptions, type SmsDestination, type SubmitWhatsAppTemplateOptions, type Suppression, type SuppressionListPayload, type SuppressionReason, type SuppressionSource, type UpdateWhatsAppTemplateOptions, type WebPushDestination, type WebPushSubscriptionToken, type WebPushTarget, type WhatsAppAttachmentInput, type WhatsAppAuthenticationTemplateComponent, type WhatsAppDestination, type WhatsAppMediaKind, type WhatsAppProviderTemplate, type WhatsAppTemplate, type WhatsAppTemplateCategory, type WhatsAppTemplateComponent, type WhatsAppTemplateStatus };
|
|
@@ -1914,5 +1914,5 @@ export declare const SUPPRESSION_NOTE_MAX_LENGTH = 500;
|
|
|
1914
1914
|
/** Limite do `subject`, em caracteres. */
|
|
1915
1915
|
export declare const MESSAGE_SUBJECT_MAX_LENGTH = 998;
|
|
1916
1916
|
/** Versão do pacote `franchising`, a mesma do `package.json`. */
|
|
1917
|
-
export declare const VERSION = "0.
|
|
1917
|
+
export declare const VERSION = "0.8.0";
|
|
1918
1918
|
export { type AcceptedBatchMessage, type AcceptedDelivery, type AcceptedMessage, type AcceptedMessageRetry, type AcceptedWebPushDelivery, type AttachmentContent, type AttachmentContentInput, type AttachmentInput, type AttachmentUrlInput, type BatchCreateSuppressionsOptions, type BatchCreateSuppressionsPayload, type BatchDeleteSuppressionsOptions, type BatchDeleteSuppressionsPayload, type BatchRequestOptions, type BatchSendEmailInput, type BatchSendMessageOptions, type BatchSendSmsInput, type BatchSendWebPushInput, type BatchSendWhatsAppInput, type CreateSuppressionOptions, type CreateWebPushSubscriptionTokenInput, type CreateWhatsAppTemplateOptions, type DeletedSuppression, type EmailAttachmentDisposition, type EmailAttachmentInput, type EmailAttachmentOptions, type EmailDestination, type FetchLike, type IsoDateTime, type JsonObject, type ListMessagesOptions, type ListSuppressionsOptions, type ListedMessage, type ListedMessageChannel, type LooseString, type Message, type MessageAttachment, type MessageAttachmentSource, type MessageAttempt, type MessageAttemptOutcome, type MessageChannel, type MessageDeliveryStatus, type MessageDestination, type MessageEvent, type MessageEventType, type MessageListPayload, type MessagePriority, type MessageRetry, type MessageStatus, Messaging as default, type MessagingConfig, type MessagingErrorCode, type MessagingErrorOptions, type ProviderChannel, type ProviderId, type RequestOptions, type Result, type RetryMessageOptions, type SendEmailInput, type SendEmailOptions, type SendMessageOptions, type SendSmsInput, type SendSmsOptions, type SendWebPushInput, type SendWebPushOptions, type SendWhatsAppInput, type SendWhatsAppOptions, type SmsDestination, type SubmitWhatsAppTemplateOptions, type Suppression, type SuppressionListPayload, type SuppressionReason, type SuppressionSource, type UpdateWhatsAppTemplateOptions, type WebPushDestination, type WebPushSubscriptionToken, type WebPushTarget, type WhatsAppAttachmentInput, type WhatsAppAuthenticationTemplateComponent, type WhatsAppDestination, type WhatsAppMediaKind, type WhatsAppProviderTemplate, type WhatsAppTemplate, type WhatsAppTemplateCategory, type WhatsAppTemplateComponent, type WhatsAppTemplateStatus };
|