@dereekb/firebase-server 13.32.0 → 13.34.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/calcom/index.cjs.default.js +1 -0
- package/calcom/index.cjs.js +1451 -0
- package/calcom/index.cjs.mjs +2 -0
- package/calcom/index.d.ts +1 -0
- package/calcom/index.esm.js +1437 -0
- package/calcom/package.json +29 -0
- package/calcom/src/index.d.ts +1 -0
- package/calcom/src/lib/calcom.oauth.connection.cache.d.ts +49 -0
- package/calcom/src/lib/calcom.oauth.connection.config.d.ts +75 -0
- package/calcom/src/lib/calcom.oauth.connection.context.d.ts +84 -0
- package/calcom/src/lib/calcom.oauth.connection.controller.d.ts +18 -0
- package/calcom/src/lib/calcom.oauth.connection.module.d.ts +55 -0
- package/calcom/src/lib/calcom.oauth.connection.service.d.ts +33 -0
- package/calcom/src/lib/index.d.ts +6 -0
- package/discord/index.cjs.default.js +1 -0
- package/discord/index.cjs.js +761 -0
- package/discord/index.cjs.mjs +2 -0
- package/discord/index.d.ts +1 -0
- package/discord/index.esm.js +753 -0
- package/discord/package.json +29 -0
- package/discord/src/index.d.ts +1 -0
- package/discord/src/lib/discord.oauth.connection.config.d.ts +69 -0
- package/discord/src/lib/discord.oauth.connection.controller.d.ts +18 -0
- package/discord/src/lib/discord.oauth.connection.module.d.ts +39 -0
- package/discord/src/lib/discord.oauth.connection.service.d.ts +43 -0
- package/discord/src/lib/index.d.ts +4 -0
- package/index.cjs.js +42 -9
- package/index.esm.js +42 -9
- package/mailgun/package.json +9 -9
- package/mcp/package.json +11 -11
- package/model/index.cjs.js +4243 -855
- package/model/index.esm.js +4183 -862
- package/model/package.json +10 -9
- package/model/src/lib/index.d.ts +2 -0
- package/model/src/lib/system/index.d.ts +2 -0
- package/model/src/lib/system/system.private.d.ts +63 -0
- package/model/src/lib/system/system.private.module.d.ts +70 -0
- package/model/src/lib/userexternalconnection/index.d.ts +8 -0
- package/model/src/lib/userexternalconnection/oauth/index.d.ts +7 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.config.d.ts +110 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.controller.d.ts +68 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.error.d.ts +29 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.refresh.d.ts +24 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.registry.d.ts +54 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.service.d.ts +216 -0
- package/model/src/lib/userexternalconnection/oauth/userexternalconnection.oauth.state.d.ts +114 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.accessor.service.d.ts +111 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.action.server.d.ts +172 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.error.d.ts +44 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.module.d.ts +129 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.private.d.ts +192 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.reader.service.d.ts +157 -0
- package/model/src/lib/userexternalconnection/userexternalconnection.refresh.service.d.ts +46 -0
- package/oidc/index.cjs.js +104 -78
- package/oidc/index.esm.js +104 -78
- package/oidc/package.json +10 -10
- package/package.json +24 -10
- package/src/lib/env/env.config.d.ts +15 -0
- package/src/lib/env/env.service.d.ts +7 -0
- package/src/lib/firestore/snapshot/snapshot.field.encrypt.d.ts +21 -2
- package/src/lib/nest/env/env.service.d.ts +1 -0
- package/test/index.cjs.js +14 -2
- package/test/index.esm.js +15 -3
- package/test/package.json +11 -11
- package/test/src/lib/firebase/firebase.admin.auth.d.ts +1 -1
- package/twilio/package.json +8 -8
- package/zoho/README.md +38 -0
- package/zoho/index.cjs.js +1418 -64
- package/zoho/index.esm.js +1401 -67
- package/zoho/package.json +13 -9
- package/zoho/src/lib/index.d.ts +6 -0
- package/zoho/src/lib/zoho.accounts.firebase.d.ts +10 -3
- package/zoho/src/lib/zoho.accounts.firebase.module.d.ts +51 -0
- package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +51 -8
- package/zoho/src/lib/zoho.oauth.connection.cache.d.ts +45 -0
- package/zoho/src/lib/zoho.oauth.connection.config.d.ts +80 -0
- package/zoho/src/lib/zoho.oauth.connection.controller.d.ts +18 -0
- package/zoho/src/lib/zoho.oauth.connection.module.d.ts +43 -0
- package/zoho/src/lib/zoho.oauth.connection.service.d.ts +107 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dereekb/firebase-server/discord",
|
|
3
|
+
"version": "13.34.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@dereekb/analytics": "13.34.0",
|
|
6
|
+
"@dereekb/date": "13.34.0",
|
|
7
|
+
"@dereekb/discord": "13.34.0",
|
|
8
|
+
"@dereekb/firebase": "13.34.0",
|
|
9
|
+
"@dereekb/firebase-server": "13.34.0",
|
|
10
|
+
"@dereekb/model": "13.34.0",
|
|
11
|
+
"@dereekb/nestjs": "13.34.0",
|
|
12
|
+
"@dereekb/rxjs": "13.34.0",
|
|
13
|
+
"@dereekb/util": "13.34.0",
|
|
14
|
+
"@nestjs/common": "^11.1.19",
|
|
15
|
+
"express": "^5.2.1"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": "./package.json",
|
|
19
|
+
".": {
|
|
20
|
+
"module": "./index.esm.js",
|
|
21
|
+
"types": "./index.d.ts",
|
|
22
|
+
"import": "./index.cjs.mjs",
|
|
23
|
+
"default": "./index.cjs.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"module": "./index.esm.js",
|
|
27
|
+
"main": "./index.cjs.js",
|
|
28
|
+
"types": "./index.d.ts"
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type DiscordOAuthScope } from '@dereekb/discord';
|
|
2
|
+
import { type FirebaseServerEnvService } from '@dereekb/firebase-server';
|
|
3
|
+
import { UserExternalConnectionOAuthServiceConfig } from '@dereekb/firebase-server/model';
|
|
4
|
+
import { type Maybe } from '@dereekb/util';
|
|
5
|
+
/**
|
|
6
|
+
* Controller path the Discord external-connection OAuth endpoints are mounted at.
|
|
7
|
+
*
|
|
8
|
+
* Derived from the framework's path factory, the same expression the redirect URI and the
|
|
9
|
+
* global-prefix exclusion are built from, so the three cannot drift apart.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DISCORD_USER_EXTERNAL_CONNECTION_OAUTH_CONTROLLER_PATH: string;
|
|
12
|
+
/**
|
|
13
|
+
* Routes to exclude from an app's global API route prefix so the Discord callback controller stays
|
|
14
|
+
* mounted at `/oauth/discord/*`.
|
|
15
|
+
*
|
|
16
|
+
* Spread this into the `exclude` list of the app's `globalApiRoutePrefix` config, alongside
|
|
17
|
+
* `FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DISCORD_USER_EXTERNAL_CONNECTION_OAUTH_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE: string[];
|
|
20
|
+
/**
|
|
21
|
+
* The scopes requested when an app does not declare its own.
|
|
22
|
+
*
|
|
23
|
+
* Declared in code, deliberately NOT read from the environment: the set to request follows from what
|
|
24
|
+
* the integration actually does, so it is a property of the code rather than of a deployment.
|
|
25
|
+
*
|
|
26
|
+
* `identify` alone. It is the least-privilege scope that still makes a Discord connection meaningful
|
|
27
|
+
* — a token granted no scopes can do nothing — and it is what lets the connection be labeled with the
|
|
28
|
+
* account it belongs to. Excludes `email`, which is a real privilege escalation the label does not
|
|
29
|
+
* need, and `guilds` / `connections` / `bot`, which nothing here reads.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_DISCORD_OAUTH_SCOPES: readonly DiscordOAuthScope[];
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for the {@link DiscordUserExternalConnectionOAuthService}.
|
|
34
|
+
*
|
|
35
|
+
* Extends the framework config with the one thing that is Discord's own — which scopes to request.
|
|
36
|
+
*
|
|
37
|
+
* The client credentials are NOT here: they belong to `DiscordOAuthServiceConfig` in
|
|
38
|
+
* `@dereekb/discord/nestjs`, and the service reads them through the injected `DiscordOAuthApi`.
|
|
39
|
+
*/
|
|
40
|
+
export declare abstract class DiscordUserExternalConnectionOAuthServiceConfig extends UserExternalConnectionOAuthServiceConfig {
|
|
41
|
+
readonly scopes: readonly DiscordOAuthScope[];
|
|
42
|
+
}
|
|
43
|
+
export interface DiscordUserExternalConnectionOAuthServiceConfigFactoryConfig {
|
|
44
|
+
readonly envService: FirebaseServerEnvService;
|
|
45
|
+
/**
|
|
46
|
+
* Path on the app URL the user is returned to after connecting, e.g. `/app/settings`.
|
|
47
|
+
*/
|
|
48
|
+
readonly successPath: string;
|
|
49
|
+
/**
|
|
50
|
+
* Path on the app URL the user is returned to after a failed connect. Defaults to `successPath`.
|
|
51
|
+
*/
|
|
52
|
+
readonly failurePath?: Maybe<string>;
|
|
53
|
+
/**
|
|
54
|
+
* The scopes to request. Defaults to {@link DEFAULT_DISCORD_OAUTH_SCOPES}.
|
|
55
|
+
*/
|
|
56
|
+
readonly scopes?: Maybe<readonly DiscordOAuthScope[]>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Builds the Discord connect flow's configuration from the app's configured origins.
|
|
60
|
+
*
|
|
61
|
+
* Nothing here is read from the environment as a value: the redirect URI is derived from the app's
|
|
62
|
+
* OAuth origin plus the mounted controller path, and the return URLs from the app URL plus
|
|
63
|
+
* code-declared paths. The client credentials are read by `discordOAuthServiceConfigFactory` in
|
|
64
|
+
* `@dereekb/discord/nestjs`, so registering Discord adds no deployment configuration here.
|
|
65
|
+
*
|
|
66
|
+
* @param config - The env service, the return paths, and the optional scope override.
|
|
67
|
+
* @returns The validated service configuration.
|
|
68
|
+
*/
|
|
69
|
+
export declare function discordUserExternalConnectionOAuthServiceConfigFactory(config: DiscordUserExternalConnectionOAuthServiceConfigFactoryConfig): DiscordUserExternalConnectionOAuthServiceConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AbstractUserExternalConnectionOAuthController } from '@dereekb/firebase-server/model';
|
|
2
|
+
import { DiscordUserExternalConnectionOAuthService } from './discord.oauth.connection.service';
|
|
3
|
+
/**
|
|
4
|
+
* Endpoints for the Discord external-connection authorization-code handoff.
|
|
5
|
+
*
|
|
6
|
+
* Mounted at `/oauth/discord`, matching the Angular registry's default authorize path of
|
|
7
|
+
* `/oauth/<providerType>/authorize`. Hosting rewrites do not strip the path, so this prefix is the
|
|
8
|
+
* public path — but an app with a global API route prefix must ALSO exclude these routes from it via
|
|
9
|
+
* {@link DISCORD_USER_EXTERNAL_CONNECTION_OAUTH_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE}, or they land under
|
|
10
|
+
* that prefix instead and no longer match the redirect URI registered with Discord.
|
|
11
|
+
*
|
|
12
|
+
* The `authorize` and `callback` routes come from the base class, so this declares only where they
|
|
13
|
+
* mount and which service serves them.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DiscordUserExternalConnectionOAuthController extends AbstractUserExternalConnectionOAuthController {
|
|
16
|
+
readonly oauthService: DiscordUserExternalConnectionOAuthService;
|
|
17
|
+
constructor(oauthService: DiscordUserExternalConnectionOAuthService);
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { type DiscordOAuthScope } from '@dereekb/discord';
|
|
3
|
+
import { type Maybe } from '@dereekb/util';
|
|
4
|
+
export interface ProvideAppDiscordUserExternalConnectionOAuthMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
5
|
+
/**
|
|
6
|
+
* This module requires the following dependencies in order to initialize properly:
|
|
7
|
+
* - DiscordOAuthApi
|
|
8
|
+
*
|
|
9
|
+
* This module declaration makes it easier to import a module that exports that dependency.
|
|
10
|
+
*/
|
|
11
|
+
readonly dependencyModule?: Maybe<Required<ModuleMetadata>['imports']['0']>;
|
|
12
|
+
/**
|
|
13
|
+
* Path on the app URL the user is returned to after connecting, e.g. `/app/settings`.
|
|
14
|
+
*/
|
|
15
|
+
readonly successPath: string;
|
|
16
|
+
/**
|
|
17
|
+
* Path on the app URL the user is returned to after a failed connect. Defaults to `successPath`.
|
|
18
|
+
*/
|
|
19
|
+
readonly failurePath?: Maybe<string>;
|
|
20
|
+
/**
|
|
21
|
+
* The scopes to request. Defaults to `DEFAULT_DISCORD_OAUTH_SCOPES`.
|
|
22
|
+
*/
|
|
23
|
+
readonly scopes?: Maybe<readonly DiscordOAuthScope[]>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convenience function used to generate ModuleMetadata for an app's Discord external-connection
|
|
27
|
+
* OAuth module.
|
|
28
|
+
*
|
|
29
|
+
* Opt-in, like the webhook module: importing the Discord OAuth module alone never mounts HTTP routes,
|
|
30
|
+
* so an app that only runs a Discord bot exposes no connect endpoints.
|
|
31
|
+
*
|
|
32
|
+
* The importing module must also supply `UserExternalConnectionServerActions` and
|
|
33
|
+
* `UserExternalConnectionStateCoder` — both exported by `appUserExternalConnectionModuleMetadata`,
|
|
34
|
+
* so pass that module in `imports`.
|
|
35
|
+
*
|
|
36
|
+
* @param config - The module metadata configuration.
|
|
37
|
+
* @returns NestJS ModuleMetadata mounting the Discord connect endpoints.
|
|
38
|
+
*/
|
|
39
|
+
export declare function appDiscordUserExternalConnectionOAuthModuleMetadata(config: ProvideAppDiscordUserExternalConnectionOAuthMetadataConfig): ModuleMetadata;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type DiscordAccessToken, type DiscordOAuthAuthorizeUrlFactory, type DiscordOAuthCurrentUser } from '@dereekb/discord';
|
|
2
|
+
import { DiscordOAuthApi } from '@dereekb/discord/nestjs';
|
|
3
|
+
import { AbstractUserExternalConnectionOAuthService, UserExternalConnectionAccessor, UserExternalConnectionServerActions, UserExternalConnectionStateCoder, type UserExternalConnectionCredentials, type UserExternalConnectionOAuthExchangeInput, type UserExternalConnectionOAuthRefreshCredentialsInput, type UserExternalConnectionOAuthState } from '@dereekb/firebase-server/model';
|
|
4
|
+
import { type Maybe, type WebsiteUrl } from '@dereekb/util';
|
|
5
|
+
import { DiscordUserExternalConnectionOAuthServiceConfig } from './discord.oauth.connection.config';
|
|
6
|
+
export interface DiscordUserExternalConnectionCredentialsInput {
|
|
7
|
+
readonly accessToken: DiscordAccessToken;
|
|
8
|
+
/**
|
|
9
|
+
* The Discord account the token belongs to, when one could be read.
|
|
10
|
+
*
|
|
11
|
+
* Optional because the identity call is best-effort: a connection is fully usable unlabeled.
|
|
12
|
+
*/
|
|
13
|
+
readonly currentUser?: Maybe<DiscordOAuthCurrentUser>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Maps an exchanged Discord token, plus the identity it belongs to, to the credentials stored on the
|
|
17
|
+
* private connection document.
|
|
18
|
+
*
|
|
19
|
+
* The `refreshToken` written here is the one the exchange returned. Discord's refresh responses carry
|
|
20
|
+
* a refresh token of their own, so persisting whatever came back is correct whether or not it rotated.
|
|
21
|
+
*
|
|
22
|
+
* @param input - The exchanged token and the resolved Discord user, when one could be read.
|
|
23
|
+
* @returns The credentials to store.
|
|
24
|
+
*/
|
|
25
|
+
export declare function discordUserExternalConnectionCredentials(input: DiscordUserExternalConnectionCredentialsInput): UserExternalConnectionCredentials;
|
|
26
|
+
/**
|
|
27
|
+
* Discord's half of the external-connection authorization-code handoff.
|
|
28
|
+
*
|
|
29
|
+
* Everything else — resolving who is connecting, surfacing a refusal, persisting the credentials,
|
|
30
|
+
* choosing the redirect — is the framework's.
|
|
31
|
+
*/
|
|
32
|
+
export declare class DiscordUserExternalConnectionOAuthService extends AbstractUserExternalConnectionOAuthService {
|
|
33
|
+
readonly config: DiscordUserExternalConnectionOAuthServiceConfig;
|
|
34
|
+
readonly stateCoder: UserExternalConnectionStateCoder;
|
|
35
|
+
readonly userExternalConnectionActions: UserExternalConnectionServerActions;
|
|
36
|
+
readonly userExternalConnectionAccessor: UserExternalConnectionAccessor;
|
|
37
|
+
readonly oauthApi: DiscordOAuthApi;
|
|
38
|
+
readonly authorizeUrlFactory: DiscordOAuthAuthorizeUrlFactory;
|
|
39
|
+
constructor(config: DiscordUserExternalConnectionOAuthServiceConfig, stateCoder: UserExternalConnectionStateCoder, userExternalConnectionActions: UserExternalConnectionServerActions, userExternalConnectionAccessor: UserExternalConnectionAccessor, oauthApi: DiscordOAuthApi);
|
|
40
|
+
protected authorizeUrlForState(state: UserExternalConnectionOAuthState): WebsiteUrl;
|
|
41
|
+
protected credentialsForAuthorizationCode(input: UserExternalConnectionOAuthExchangeInput): Promise<UserExternalConnectionCredentials>;
|
|
42
|
+
refreshCredentials(input: UserExternalConnectionOAuthRefreshCredentialsInput): Promise<UserExternalConnectionCredentials>;
|
|
43
|
+
}
|
package/index.cjs.js
CHANGED
|
@@ -4517,8 +4517,10 @@ var _obj;
|
|
|
4517
4517
|
* Creates a Firestore field mapping that encrypts/decrypts a JSON-serializable value
|
|
4518
4518
|
* using AES-256-GCM. The value is stored in Firestore as a base64-encoded string.
|
|
4519
4519
|
*
|
|
4520
|
-
*
|
|
4521
|
-
*
|
|
4520
|
+
* IMPORTANT: there is NO key rotation. `resolveEncryptionKey()` reads and validates the secret once,
|
|
4521
|
+
* here at construction, and closes over the resulting key — changing the secret afterwards orphans
|
|
4522
|
+
* every value already written with the old one. Rotation is only survivable for fields that supply
|
|
4523
|
+
* {@link FirestoreEncryptedFieldConfig.onDecodeFailure} and hold regenerable data.
|
|
4522
4524
|
*
|
|
4523
4525
|
* @param config - Encryption field configuration.
|
|
4524
4526
|
* @returns A field mapping configuration for encrypted values.
|
|
@@ -4535,12 +4537,22 @@ var _obj;
|
|
|
4535
4537
|
*
|
|
4536
4538
|
* @__NO_SIDE_EFFECTS__
|
|
4537
4539
|
*/ function firestoreEncryptedField(config) {
|
|
4538
|
-
var secret = config.secret, defaultValue = config.default;
|
|
4540
|
+
var secret = config.secret, defaultValue = config.default, onDecodeFailure = config.onDecodeFailure;
|
|
4539
4541
|
var getKey = nestjs.resolveEncryptionKey(secret);
|
|
4540
4542
|
return firebase.firestoreField({
|
|
4541
4543
|
default: defaultValue,
|
|
4542
4544
|
fromData: function fromData(data) {
|
|
4543
|
-
|
|
4545
|
+
var result;
|
|
4546
|
+
if (onDecodeFailure == null) {
|
|
4547
|
+
result = nestjs.decryptValue(data, getKey());
|
|
4548
|
+
} else {
|
|
4549
|
+
try {
|
|
4550
|
+
result = nestjs.decryptValue(data, getKey());
|
|
4551
|
+
} catch (e) {
|
|
4552
|
+
result = onDecodeFailure(e, data);
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
return result;
|
|
4544
4556
|
},
|
|
4545
4557
|
toData: function toData(value) {
|
|
4546
4558
|
return nestjs.encryptValue(value, getKey());
|
|
@@ -4567,11 +4579,21 @@ var _obj;
|
|
|
4567
4579
|
*
|
|
4568
4580
|
* @__NO_SIDE_EFFECTS__
|
|
4569
4581
|
*/ function optionalFirestoreEncryptedField(config) {
|
|
4570
|
-
var secret = config.secret;
|
|
4582
|
+
var secret = config.secret, onDecodeFailure = config.onDecodeFailure;
|
|
4571
4583
|
var getKey = nestjs.resolveEncryptionKey(secret);
|
|
4572
4584
|
return firebase.optionalFirestoreField({
|
|
4573
4585
|
transformFromData: function transformFromData(data) {
|
|
4574
|
-
|
|
4586
|
+
var result;
|
|
4587
|
+
if (onDecodeFailure == null) {
|
|
4588
|
+
result = nestjs.decryptValue(data, getKey());
|
|
4589
|
+
} else {
|
|
4590
|
+
try {
|
|
4591
|
+
result = nestjs.decryptValue(data, getKey());
|
|
4592
|
+
} catch (e) {
|
|
4593
|
+
result = onDecodeFailure(e, data);
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4596
|
+
return result;
|
|
4575
4597
|
},
|
|
4576
4598
|
transformToData: function transformToData(value) {
|
|
4577
4599
|
return nestjs.encryptValue(value, getKey());
|
|
@@ -7728,14 +7750,19 @@ function _ts_generator$9(thisArg, body) {
|
|
|
7728
7750
|
}
|
|
7729
7751
|
/**
|
|
7730
7752
|
* Derives a fallback read-error message from a resolved error code, distinguishing not-found from
|
|
7731
|
-
* permission-denied. Accepts both the server-error form (`NOT_FOUND` / `
|
|
7732
|
-
* `FORBIDDEN`) and the Firebase HttpsError form (`not-found` /
|
|
7753
|
+
* permission-denied. Accepts both the server-error form (`NOT_FOUND` / `MODEL_NOT_AVAILABLE` /
|
|
7754
|
+
* `PERMISSION_DENIED` / `FORBIDDEN`) and the Firebase HttpsError form (`not-found` /
|
|
7755
|
+
* `permission-denied`).
|
|
7756
|
+
*
|
|
7757
|
+
* `MODEL_NOT_AVAILABLE` is the code a missing document actually produces on this path — the
|
|
7758
|
+
* per-key existence check throws {@link nestFirebaseDoesNotExistError}, i.e. `modelNotAvailableError()`
|
|
7759
|
+
* — so it must map to not-found rather than falling through to the generic message.
|
|
7733
7760
|
*
|
|
7734
7761
|
* @param code - The resolved error code (`serverErrorCode ?? firebaseErrorCode`), if any.
|
|
7735
7762
|
* @returns `'not found'`, `'permission denied'`, or a generic `'unknown error'` fallback.
|
|
7736
7763
|
*/ function modelAccessReadErrorMessageFromCode(code) {
|
|
7737
7764
|
var message;
|
|
7738
|
-
if (code === firebase.NOT_FOUND_ERROR_CODE || code === 'not-found') {
|
|
7765
|
+
if (code === firebase.NOT_FOUND_ERROR_CODE || code === firebase.MODEL_NOT_AVAILABLE_ERROR_CODE || code === 'not-found') {
|
|
7739
7766
|
message = 'not found';
|
|
7740
7767
|
} else if (code === firebase.PERMISSION_DENIED_ERROR_CODE || code === firebase.FORBIDDEN_ERROR_CODE || code === 'permission-denied') {
|
|
7741
7768
|
message = 'permission denied';
|
|
@@ -9418,6 +9445,12 @@ function _is_native_reflect_construct$1() {
|
|
|
9418
9445
|
return this.env.appMcpUrl;
|
|
9419
9446
|
}
|
|
9420
9447
|
},
|
|
9448
|
+
{
|
|
9449
|
+
key: "appOAuthUrl",
|
|
9450
|
+
get: function get() {
|
|
9451
|
+
return this.env.appOAuthUrl;
|
|
9452
|
+
}
|
|
9453
|
+
},
|
|
9421
9454
|
{
|
|
9422
9455
|
key: "appWebhookUrl",
|
|
9423
9456
|
get: function get() {
|
package/index.esm.js
CHANGED
|
@@ -4515,8 +4515,10 @@ var _obj;
|
|
|
4515
4515
|
* Creates a Firestore field mapping that encrypts/decrypts a JSON-serializable value
|
|
4516
4516
|
* using AES-256-GCM. The value is stored in Firestore as a base64-encoded string.
|
|
4517
4517
|
*
|
|
4518
|
-
*
|
|
4519
|
-
*
|
|
4518
|
+
* IMPORTANT: there is NO key rotation. `resolveEncryptionKey()` reads and validates the secret once,
|
|
4519
|
+
* here at construction, and closes over the resulting key — changing the secret afterwards orphans
|
|
4520
|
+
* every value already written with the old one. Rotation is only survivable for fields that supply
|
|
4521
|
+
* {@link FirestoreEncryptedFieldConfig.onDecodeFailure} and hold regenerable data.
|
|
4520
4522
|
*
|
|
4521
4523
|
* @param config - Encryption field configuration.
|
|
4522
4524
|
* @returns A field mapping configuration for encrypted values.
|
|
@@ -4533,12 +4535,22 @@ var _obj;
|
|
|
4533
4535
|
*
|
|
4534
4536
|
* @__NO_SIDE_EFFECTS__
|
|
4535
4537
|
*/ function firestoreEncryptedField(config) {
|
|
4536
|
-
var secret = config.secret, defaultValue = config.default;
|
|
4538
|
+
var secret = config.secret, defaultValue = config.default, onDecodeFailure = config.onDecodeFailure;
|
|
4537
4539
|
var getKey = resolveEncryptionKey(secret);
|
|
4538
4540
|
return firestoreField({
|
|
4539
4541
|
default: defaultValue,
|
|
4540
4542
|
fromData: function fromData(data) {
|
|
4541
|
-
|
|
4543
|
+
var result;
|
|
4544
|
+
if (onDecodeFailure == null) {
|
|
4545
|
+
result = decryptValue(data, getKey());
|
|
4546
|
+
} else {
|
|
4547
|
+
try {
|
|
4548
|
+
result = decryptValue(data, getKey());
|
|
4549
|
+
} catch (e) {
|
|
4550
|
+
result = onDecodeFailure(e, data);
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
return result;
|
|
4542
4554
|
},
|
|
4543
4555
|
toData: function toData(value) {
|
|
4544
4556
|
return encryptValue(value, getKey());
|
|
@@ -4565,11 +4577,21 @@ var _obj;
|
|
|
4565
4577
|
*
|
|
4566
4578
|
* @__NO_SIDE_EFFECTS__
|
|
4567
4579
|
*/ function optionalFirestoreEncryptedField(config) {
|
|
4568
|
-
var secret = config.secret;
|
|
4580
|
+
var secret = config.secret, onDecodeFailure = config.onDecodeFailure;
|
|
4569
4581
|
var getKey = resolveEncryptionKey(secret);
|
|
4570
4582
|
return optionalFirestoreField({
|
|
4571
4583
|
transformFromData: function transformFromData(data) {
|
|
4572
|
-
|
|
4584
|
+
var result;
|
|
4585
|
+
if (onDecodeFailure == null) {
|
|
4586
|
+
result = decryptValue(data, getKey());
|
|
4587
|
+
} else {
|
|
4588
|
+
try {
|
|
4589
|
+
result = decryptValue(data, getKey());
|
|
4590
|
+
} catch (e) {
|
|
4591
|
+
result = onDecodeFailure(e, data);
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
return result;
|
|
4573
4595
|
},
|
|
4574
4596
|
transformToData: function transformToData(value) {
|
|
4575
4597
|
return encryptValue(value, getKey());
|
|
@@ -7726,14 +7748,19 @@ function _ts_generator$9(thisArg, body) {
|
|
|
7726
7748
|
}
|
|
7727
7749
|
/**
|
|
7728
7750
|
* Derives a fallback read-error message from a resolved error code, distinguishing not-found from
|
|
7729
|
-
* permission-denied. Accepts both the server-error form (`NOT_FOUND` / `
|
|
7730
|
-
* `FORBIDDEN`) and the Firebase HttpsError form (`not-found` /
|
|
7751
|
+
* permission-denied. Accepts both the server-error form (`NOT_FOUND` / `MODEL_NOT_AVAILABLE` /
|
|
7752
|
+
* `PERMISSION_DENIED` / `FORBIDDEN`) and the Firebase HttpsError form (`not-found` /
|
|
7753
|
+
* `permission-denied`).
|
|
7754
|
+
*
|
|
7755
|
+
* `MODEL_NOT_AVAILABLE` is the code a missing document actually produces on this path — the
|
|
7756
|
+
* per-key existence check throws {@link nestFirebaseDoesNotExistError}, i.e. `modelNotAvailableError()`
|
|
7757
|
+
* — so it must map to not-found rather than falling through to the generic message.
|
|
7731
7758
|
*
|
|
7732
7759
|
* @param code - The resolved error code (`serverErrorCode ?? firebaseErrorCode`), if any.
|
|
7733
7760
|
* @returns `'not found'`, `'permission denied'`, or a generic `'unknown error'` fallback.
|
|
7734
7761
|
*/ function modelAccessReadErrorMessageFromCode(code) {
|
|
7735
7762
|
var message;
|
|
7736
|
-
if (code === NOT_FOUND_ERROR_CODE || code === 'not-found') {
|
|
7763
|
+
if (code === NOT_FOUND_ERROR_CODE || code === MODEL_NOT_AVAILABLE_ERROR_CODE || code === 'not-found') {
|
|
7737
7764
|
message = 'not found';
|
|
7738
7765
|
} else if (code === PERMISSION_DENIED_ERROR_CODE || code === FORBIDDEN_ERROR_CODE || code === 'permission-denied') {
|
|
7739
7766
|
message = 'permission denied';
|
|
@@ -9416,6 +9443,12 @@ function _is_native_reflect_construct$1() {
|
|
|
9416
9443
|
return this.env.appMcpUrl;
|
|
9417
9444
|
}
|
|
9418
9445
|
},
|
|
9446
|
+
{
|
|
9447
|
+
key: "appOAuthUrl",
|
|
9448
|
+
get: function get() {
|
|
9449
|
+
return this.env.appOAuthUrl;
|
|
9450
|
+
}
|
|
9451
|
+
},
|
|
9419
9452
|
{
|
|
9420
9453
|
key: "appWebhookUrl",
|
|
9421
9454
|
get: function get() {
|
package/mailgun/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/mailgun",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.34.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.
|
|
6
|
-
"@dereekb/firebase": "13.
|
|
7
|
-
"@dereekb/firebase-server": "13.
|
|
8
|
-
"@dereekb/date": "13.
|
|
9
|
-
"@dereekb/nestjs": "13.
|
|
10
|
-
"@dereekb/model": "13.
|
|
11
|
-
"@dereekb/rxjs": "13.
|
|
12
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/analytics": "13.34.0",
|
|
6
|
+
"@dereekb/firebase": "13.34.0",
|
|
7
|
+
"@dereekb/firebase-server": "13.34.0",
|
|
8
|
+
"@dereekb/date": "13.34.0",
|
|
9
|
+
"@dereekb/nestjs": "13.34.0",
|
|
10
|
+
"@dereekb/model": "13.34.0",
|
|
11
|
+
"@dereekb/rxjs": "13.34.0",
|
|
12
|
+
"@dereekb/util": "13.34.0"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
"./package.json": "./package.json",
|
package/mcp/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/mcp",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.34.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.
|
|
6
|
-
"@dereekb/date": "13.
|
|
7
|
-
"@dereekb/firebase": "13.
|
|
8
|
-
"@dereekb/firebase-server": "13.
|
|
9
|
-
"@dereekb/firebase-server/oidc": "13.
|
|
10
|
-
"@dereekb/model": "13.
|
|
11
|
-
"@dereekb/nestjs": "13.
|
|
12
|
-
"@dereekb/rxjs": "13.
|
|
13
|
-
"@dereekb/util": "13.
|
|
14
|
-
"@dereekb/zoho": "13.
|
|
5
|
+
"@dereekb/analytics": "13.34.0",
|
|
6
|
+
"@dereekb/date": "13.34.0",
|
|
7
|
+
"@dereekb/firebase": "13.34.0",
|
|
8
|
+
"@dereekb/firebase-server": "13.34.0",
|
|
9
|
+
"@dereekb/firebase-server/oidc": "13.34.0",
|
|
10
|
+
"@dereekb/model": "13.34.0",
|
|
11
|
+
"@dereekb/nestjs": "13.34.0",
|
|
12
|
+
"@dereekb/rxjs": "13.34.0",
|
|
13
|
+
"@dereekb/util": "13.34.0",
|
|
14
|
+
"@dereekb/zoho": "13.34.0",
|
|
15
15
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
16
16
|
"@nestjs/common": "^11.1.19",
|
|
17
17
|
"@nestjs/core": "^11.1.19",
|