@dereekb/firebase-server 13.11.17 → 13.12.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/index.cjs.js +218 -31
- package/index.esm.js +217 -34
- package/mailgun/package.json +9 -9
- package/mcp/index.cjs.default.js +1 -0
- package/mcp/index.cjs.js +3646 -0
- package/mcp/index.cjs.mjs +2 -0
- package/mcp/index.d.ts +1 -0
- package/mcp/index.esm.js +3609 -0
- package/mcp/package.json +33 -0
- package/mcp/src/index.d.ts +1 -0
- package/mcp/src/lib/controller/index.d.ts +2 -0
- package/mcp/src/lib/controller/mcp.controller.d.ts +19 -0
- package/mcp/src/lib/controller/mcp.wellknown.controller.d.ts +25 -0
- package/mcp/src/lib/index.d.ts +5 -0
- package/mcp/src/lib/mcp.config.d.ts +100 -0
- package/mcp/src/lib/mcp.module.d.ts +49 -0
- package/mcp/src/lib/service/index.d.ts +8 -0
- package/mcp/src/lib/service/mcp.manifest.d.ts +150 -0
- package/mcp/src/lib/service/mcp.response-formatter.d.ts +36 -0
- package/mcp/src/lib/service/mcp.server.factory.d.ts +124 -0
- package/mcp/src/lib/service/mcp.tool-generator.d.ts +235 -0
- package/mcp/src/lib/service/mcp.visibility.d.ts +99 -0
- package/mcp/src/lib/service/tools/mcp.tool.model-decode.d.ts +87 -0
- package/mcp/src/lib/service/tools/mcp.tool.model-get.d.ts +81 -0
- package/mcp/src/lib/service/tools/mcp.tool.model-info.d.ts +84 -0
- package/mcp/src/lib/service/tools/mcp.tool.whoami.d.ts +72 -0
- package/mcp/src/lib/transport/index.d.ts +1 -0
- package/mcp/src/lib/transport/streamable-http.transport.d.ts +21 -0
- package/model/index.cjs.js +639 -266
- package/model/index.esm.js +640 -270
- package/model/package.json +9 -9
- package/model/src/lib/storagefile/extension/compress.pdf.d.ts +29 -1
- package/model/src/lib/storagefile/index.d.ts +1 -0
- package/model/src/lib/storagefile/storagefile.action.server.d.ts +29 -2
- package/model/src/lib/storagefile/storagefile.mcp.d.ts +32 -0
- package/model/src/lib/storagefile/storagefile.module.d.ts +20 -3
- package/oidc/index.cjs.js +322 -147
- package/oidc/index.esm.js +321 -148
- package/oidc/package.json +10 -10
- package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -15
- package/oidc/src/lib/middleware/oauth-auth.middleware.d.ts +22 -2
- package/oidc/src/lib/middleware/oauth-auth.module.d.ts +57 -0
- package/oidc/src/lib/oidc.config.d.ts +73 -0
- package/oidc/src/lib/oidc.module.d.ts +44 -2
- package/package.json +16 -10
- package/src/lib/auth/auth.service.d.ts +16 -1
- package/src/lib/auth/auth.service.error.util.d.ts +24 -5
- package/src/lib/env/env.config.d.ts +16 -0
- package/src/lib/env/env.service.d.ts +9 -0
- package/src/lib/nest/controller/model/model.api.get.service.d.ts +35 -1
- package/src/lib/nest/env/env.service.d.ts +1 -0
- package/src/lib/nest/model/api.details.d.ts +116 -5
- package/src/lib/nest/model/crud.assert.function.d.ts +1 -1
- package/src/lib/nest/model/index.d.ts +1 -0
- package/src/lib/nest/model/invoke.model.function.d.ts +89 -0
- package/test/package.json +11 -11
- package/twilio/LICENSE +21 -0
- package/twilio/index.cjs.default.js +1 -0
- package/twilio/index.cjs.js +404 -0
- package/twilio/index.cjs.mjs +2 -0
- package/twilio/index.d.ts +1 -0
- package/twilio/index.esm.js +398 -0
- package/twilio/package.json +25 -0
- package/twilio/src/index.d.ts +1 -0
- package/twilio/src/lib/index.d.ts +1 -0
- package/twilio/src/lib/notification.send.service.twilio.d.ts +148 -0
- package/zoho/package.json +9 -9
package/model/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/model",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.
|
|
6
|
-
"@dereekb/date": "13.
|
|
7
|
-
"@dereekb/firebase": "13.
|
|
8
|
-
"@dereekb/firebase-server": "13.
|
|
9
|
-
"@dereekb/model": "13.
|
|
10
|
-
"@dereekb/nestjs": "13.
|
|
11
|
-
"@dereekb/rxjs": "13.
|
|
12
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/analytics": "13.12.0",
|
|
6
|
+
"@dereekb/date": "13.12.0",
|
|
7
|
+
"@dereekb/firebase": "13.12.0",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.0",
|
|
9
|
+
"@dereekb/model": "13.12.0",
|
|
10
|
+
"@dereekb/nestjs": "13.12.0",
|
|
11
|
+
"@dereekb/rxjs": "13.12.0",
|
|
12
|
+
"@dereekb/util": "13.12.0",
|
|
13
13
|
"@nestjs/common": "^11.1.19",
|
|
14
14
|
"@nestjs/config": "^4.0.4",
|
|
15
15
|
"archiver": "^7.0.1",
|
|
@@ -27,10 +27,38 @@ export interface CompressPdfImagesToTargetSizeConfig {
|
|
|
27
27
|
*/
|
|
28
28
|
readonly imageSizeThresholdBytes?: Maybe<number>;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Per-filter image stream counts (e.g. `{ DCTDecode: 2, FlateDecode: 1 }`). Streams
|
|
32
|
+
* with no `/Filter` entry are bucketed under `'none'`; multi-filter chains are
|
|
33
|
+
* joined with `+` (e.g. `'FlateDecode+DCTDecode'`).
|
|
34
|
+
*/
|
|
35
|
+
export type CompressPdfImageStreamsByFilter = Readonly<Record<string, number>>;
|
|
36
|
+
/**
|
|
37
|
+
* Diagnostic context describing the source PDF — useful for explaining why a
|
|
38
|
+
* compression attempt did or did not hit its target.
|
|
39
|
+
*/
|
|
40
|
+
export interface CompressPdfImagesToTargetSizeContext {
|
|
41
|
+
/**
|
|
42
|
+
* Number of pages in the source PDF.
|
|
43
|
+
*/
|
|
44
|
+
readonly pageCount: number;
|
|
45
|
+
/**
|
|
46
|
+
* Total number of image XObjects (Subtype `/Image`) found in the PDF, regardless
|
|
47
|
+
* of whether they were compressible by this implementation.
|
|
48
|
+
*/
|
|
49
|
+
readonly imageStreamCount: number;
|
|
50
|
+
/**
|
|
51
|
+
* Breakdown of image XObjects by their PDF filter. If `hitTarget` is `false` and
|
|
52
|
+
* this map only contains non-JPEG filters (e.g. `FlateDecode`, `CCITTFaxDecode`,
|
|
53
|
+
* `JBIG2Decode`, `JPXDecode`), the v1 compressor cannot help — callers should
|
|
54
|
+
* reject the upload or queue a downscale fallback.
|
|
55
|
+
*/
|
|
56
|
+
readonly imageStreamsByFilter: CompressPdfImageStreamsByFilter;
|
|
57
|
+
}
|
|
30
58
|
/**
|
|
31
59
|
* Result of {@link compressPdfImagesToTargetSize}.
|
|
32
60
|
*/
|
|
33
|
-
export interface CompressPdfImagesToTargetSizeResult {
|
|
61
|
+
export interface CompressPdfImagesToTargetSizeResult extends CompressPdfImagesToTargetSizeContext {
|
|
34
62
|
/**
|
|
35
63
|
* Best-effort compressed PDF bytes. Equal to the original buffer if recompression
|
|
36
64
|
* produced no smaller result.
|
|
@@ -2,6 +2,7 @@ export * from './extension';
|
|
|
2
2
|
export * from './storagefile.action.server';
|
|
3
3
|
export * from './storagefile.action.server.init';
|
|
4
4
|
export * from './storagefile.error';
|
|
5
|
+
export * from './storagefile.mcp';
|
|
5
6
|
export * from './storagefile.module';
|
|
6
7
|
export * from './storagefile.task.service.handler';
|
|
7
8
|
export * from './storagefile.upload.service';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FirestoreContextReference, type InitializeStorageFileFromUploadParams, type AsyncStorageFileCreateAction, type StorageFileFirestoreCollections, type ProcessStorageFileParams, type StorageFileDocument, type ProcessStorageFileResult, type CreateStorageFileParams, type AsyncStorageFileUpdateAction, type UpdateStorageFileParams, type NotificationFirestoreCollections, type FirebaseStorageAccessorFile, type InitializeAllStorageFilesFromUploadsResult, type InitializeAllStorageFilesFromUploadsParams, type ProcessAllQueuedStorageFilesParams, type ProcessAllQueuedStorageFilesResult, type DeleteAllQueuedStorageFilesParams, type DeleteAllQueuedStorageFilesResult, type DeleteStorageFileParams, type AsyncStorageFileDeleteAction, type StorageFile, type DownloadStorageFileParams, type DownloadStorageFileResult, type DownloadMultipleStorageFilesParams, type DownloadMultipleStorageFilesResult, type DownloadMultipleStorageFileSuccessItem, type FirestoreModelKey, type SyncStorageFileWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsResult, type SyncStorageFileWithGroupsResult, type RegenerateAllFlaggedStorageFileGroupsContentParams, type RegenerateAllFlaggedStorageFileGroupsContentResult, type RegenerateStorageFileGroupContentParams, type RegenerateStorageFileGroupContentResult, type StorageFileGroupDocument, type AsyncStorageFileGroupCreateAction, type CreateStorageFileGroupParams, type Transaction, type StorageFileGroup, type StorageFileGroupDocumentReferencePair, type StorageFileGroupId, type UpdateStorageFileGroupParams, type DownloadStorageFileOptions } from '@dereekb/firebase';
|
|
1
|
+
import { type FirestoreContextReference, type InitializeStorageFileFromUploadParams, type AsyncStorageFileCreateAction, type StorageFileFirestoreCollections, type ProcessStorageFileParams, type StorageFileDocument, type ProcessStorageFileResult, type CreateStorageFileParams, type AsyncStorageFileUpdateAction, type UpdateStorageFileParams, type NotificationFirestoreCollections, type FirebaseStorageAccessorFile, type InitializeAllStorageFilesFromUploadsResult, type InitializeAllStorageFilesFromUploadsParams, type ProcessAllQueuedStorageFilesParams, type ProcessAllQueuedStorageFilesResult, type DeleteAllQueuedStorageFilesParams, type DeleteAllQueuedStorageFilesResult, type DeleteStorageFileParams, type AsyncStorageFileDeleteAction, type StorageFile, type DownloadStorageFileParams, type DownloadStorageFileResult, type DownloadMultipleStorageFilesParams, type DownloadMultipleStorageFilesResult, type DownloadMultipleStorageFileSuccessItem, type FirestoreModelKey, type SyncStorageFileWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsResult, type SyncStorageFileWithGroupsResult, type RegenerateAllFlaggedStorageFileGroupsContentParams, type RegenerateAllFlaggedStorageFileGroupsContentResult, type RegenerateStorageFileGroupContentParams, type RegenerateStorageFileGroupContentResult, type StorageFileGroupDocument, type AsyncStorageFileGroupCreateAction, type CreateStorageFileGroupParams, type Transaction, type StorageFileGroup, type StorageFileGroupDocumentReferencePair, type StorageFileGroupId, type UpdateStorageFileGroupParams, type DownloadStorageFileOptions, type CreateStorageFileSignedUploadUrlParams, type CreateStorageFileSignedUploadUrlResult, type StorageFilePurposeUploadPolicy, type FirebaseAuthUserId, type AsyncFirebaseFunctionCreateAction } from '@dereekb/firebase';
|
|
2
2
|
import { type FirebaseServerStorageServiceRef, type FirebaseServerActionsContext, type FirebaseServerAuthServiceRef } from '@dereekb/firebase-server';
|
|
3
3
|
import { type TransformAndValidateFunctionResult } from '@dereekb/model';
|
|
4
4
|
import { type InjectionToken } from '@nestjs/common';
|
|
@@ -24,9 +24,11 @@ export interface BaseStorageFileServerActionsContext extends FirebaseServerActio
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Full context for storage file server actions, extending the base with the
|
|
27
|
-
* upload initialization service
|
|
27
|
+
* upload initialization service and the per-purpose signed-upload policy
|
|
28
|
+
* registry consulted by `createStorageFileSignedUploadUrl`.
|
|
28
29
|
*/
|
|
29
30
|
export interface StorageFileServerActionsContext extends BaseStorageFileServerActionsContext, StorageFileInitializeFromUploadServiceRef {
|
|
31
|
+
readonly storageFileSignedUploadPolicies: readonly StorageFilePurposeUploadPolicy[];
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
34
|
* Abstract service class defining all server-side storage file CRUD, upload processing, and group management actions.
|
|
@@ -45,6 +47,9 @@ export interface StorageFileServerActionsContext extends BaseStorageFileServerAc
|
|
|
45
47
|
*/
|
|
46
48
|
export declare abstract class StorageFileServerActions {
|
|
47
49
|
abstract createStorageFile(params: CreateStorageFileParams): AsyncStorageFileCreateAction<CreateStorageFileParams>;
|
|
50
|
+
abstract createStorageFileSignedUploadUrl(params: CreateStorageFileSignedUploadUrlParams): AsyncFirebaseFunctionCreateAction<CreateStorageFileSignedUploadUrlParams, CreateStorageFileSignedUploadUrlResult, {
|
|
51
|
+
readonly uid: FirebaseAuthUserId;
|
|
52
|
+
}>;
|
|
48
53
|
abstract initializeAllStorageFilesFromUploads(params: InitializeAllStorageFilesFromUploadsParams): Promise<TransformAndValidateFunctionResult<InitializeAllStorageFilesFromUploadsParams, () => Promise<InitializeAllStorageFilesFromUploadsResult>>>;
|
|
49
54
|
abstract initializeStorageFileFromUpload(params: InitializeStorageFileFromUploadParams): AsyncStorageFileCreateAction<InitializeStorageFileFromUploadParams>;
|
|
50
55
|
abstract updateStorageFile(params: UpdateStorageFileParams): AsyncStorageFileUpdateAction<UpdateStorageFileParams>;
|
|
@@ -86,6 +91,28 @@ export declare function storageFileServerActions(context: StorageFileServerActio
|
|
|
86
91
|
* @returns An async transform-and-validate function that creates a StorageFile document.
|
|
87
92
|
*/
|
|
88
93
|
export declare function createStorageFileFactory(context: BaseStorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateStorageFileParams, () => Promise<StorageFileDocument>, object, unknown>;
|
|
94
|
+
/**
|
|
95
|
+
* Factory for the `createStorageFileSignedUploadUrl` action.
|
|
96
|
+
*
|
|
97
|
+
* Issues a short-lived, content-type-pinned signed PUT URL into the caller's
|
|
98
|
+
* `/uploads/u/{uid}/...` namespace. The path, content-type, and size cap are
|
|
99
|
+
* derived from the per-purpose policy resolved from the
|
|
100
|
+
* `storageFileSignedUploadPolicies` registry on the context, so the URL can
|
|
101
|
+
* only write to a location that both `storage.rules` and the
|
|
102
|
+
* `StorageFileInitializeFromUploadService` initializer accept.
|
|
103
|
+
*
|
|
104
|
+
* Minting a URL does NOT create a StorageFile document — `result.modelKeys` is
|
|
105
|
+
* always empty. The document is created later by the upload-complete pipeline.
|
|
106
|
+
*
|
|
107
|
+
* @param context - The storage file server actions context. Must carry
|
|
108
|
+
* `storageFileSignedUploadPolicies` — the list of `StorageFilePurposeUploadPolicy` entries to resolve by purpose.
|
|
109
|
+
* @returns An async transform-and-validate function whose inner stage takes
|
|
110
|
+
* `{ uid }` (the authenticated user) and returns the signed-upload-url
|
|
111
|
+
* payload.
|
|
112
|
+
*/
|
|
113
|
+
export declare function createStorageFileSignedUploadUrlFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateStorageFileSignedUploadUrlParams, ({ uid }: {
|
|
114
|
+
readonly uid: FirebaseAuthUserId;
|
|
115
|
+
}) => Promise<CreateStorageFileSignedUploadUrlResult>, object, unknown>;
|
|
89
116
|
/**
|
|
90
117
|
* Factory for the `initializeAllStorageFilesFromUploads` action.
|
|
91
118
|
*
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type StorageFilePurposeUploadPolicy } from '@dereekb/firebase';
|
|
2
|
+
import { type McpToolDetailsBuilder } from '@dereekb/firebase-server';
|
|
3
|
+
/**
|
|
4
|
+
* Config for {@link storageFileCreateSignedUploadUrlToolDetailsFactory}.
|
|
5
|
+
*/
|
|
6
|
+
export interface StorageFileCreateSignedUploadUrlToolDetailsFactoryConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The list of upload policies the app supports. Each policy's `purpose` is exposed in the
|
|
9
|
+
* tool's input schema enum and described in the generated tool description.
|
|
10
|
+
*/
|
|
11
|
+
readonly policies: readonly StorageFilePurposeUploadPolicy[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Builds the {@link McpToolDetailsBuilder} that customizes the MCP tool description and
|
|
15
|
+
* input schema for the `storageFileCreateSignedUploadUrl` create-function.
|
|
16
|
+
*
|
|
17
|
+
* The factory captures the policy list once at wiring time; the returned builder is a pure
|
|
18
|
+
* synchronous function called by the framework on every `tools/list` request.
|
|
19
|
+
*
|
|
20
|
+
* @param config - Factory config containing the upload policies that drive the description and `purpose` enum.
|
|
21
|
+
* @returns A builder that emits the policy-aware tool description and an input schema with the `purpose` enum constrained to the configured purposes.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const toolDetails = storageFileCreateSignedUploadUrlToolDetailsFactory({
|
|
26
|
+
* policies: STORAGE_FILE_PURPOSE_UPLOAD_POLICIES
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @__NO_SIDE_EFFECTS__
|
|
31
|
+
*/
|
|
32
|
+
export declare function storageFileCreateSignedUploadUrlToolDetailsFactory(config: StorageFileCreateSignedUploadUrlToolDetailsFactoryConfig): McpToolDetailsBuilder;
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import { type ModuleMetadata } from '@nestjs/common';
|
|
1
|
+
import { type InjectionToken, type ModuleMetadata } from '@nestjs/common';
|
|
2
2
|
import { type Maybe } from '@dereekb/util';
|
|
3
|
+
import { type StorageFilePurposeUploadPolicy } from '@dereekb/firebase';
|
|
3
4
|
import { type BaseStorageFileServerActionsContext, StorageFileServerActions, type StorageFileServerActionsContext } from './storagefile.action.server';
|
|
4
5
|
import { StorageFileInitializeFromUploadService } from './storagefile.upload.service';
|
|
5
6
|
import { StorageFileInitServerActions, type StorageFileInitServerActionsContextConfig } from './storagefile.action.server.init';
|
|
7
|
+
/**
|
|
8
|
+
* NestJS injection token for the per-purpose `StorageFilePurposeUploadPolicy[]`
|
|
9
|
+
* registry that the `createStorageFileSignedUploadUrl` factory consults.
|
|
10
|
+
*
|
|
11
|
+
* Apps bind this token via {@link appStorageFileModuleMetadata} by passing
|
|
12
|
+
* `storageFileSignedUploadPolicies` in {@link ProvideAppStorageFileMetadataConfig}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN: InjectionToken;
|
|
6
15
|
/**
|
|
7
16
|
* Factory that assembles the full {@link StorageFileServerActionsContext} by combining
|
|
8
|
-
* the base context with the upload initialization service.
|
|
17
|
+
* the base context with the upload initialization service and the signed-upload policy registry.
|
|
9
18
|
*
|
|
10
19
|
* @param context - The base server actions context providing Firebase infrastructure.
|
|
11
20
|
* @param storageFileInitializeFromUploadService - The service for initializing storage files from uploads.
|
|
21
|
+
* @param storageFileSignedUploadPolicies - The per-purpose upload policy registry consulted by `createStorageFileSignedUploadUrl`.
|
|
12
22
|
* @returns The fully assembled StorageFileServerActionsContext.
|
|
13
23
|
*/
|
|
14
|
-
export declare function storageFileServerActionsContextFactory(context: BaseStorageFileServerActionsContext, storageFileInitializeFromUploadService: StorageFileInitializeFromUploadService): StorageFileServerActionsContext;
|
|
24
|
+
export declare function storageFileServerActionsContextFactory(context: BaseStorageFileServerActionsContext, storageFileInitializeFromUploadService: StorageFileInitializeFromUploadService, storageFileSignedUploadPolicies: readonly StorageFilePurposeUploadPolicy[]): StorageFileServerActionsContext;
|
|
15
25
|
/**
|
|
16
26
|
* Factory that creates a {@link StorageFileServerActions} instance from the assembled context.
|
|
17
27
|
*
|
|
@@ -38,6 +48,13 @@ export interface ProvideAppStorageFileMetadataConfig extends Pick<ModuleMetadata
|
|
|
38
48
|
* This module declaration makes it easier to import a module that exports those depenendencies.
|
|
39
49
|
*/
|
|
40
50
|
readonly dependencyModule?: Maybe<Required<ModuleMetadata>['imports']['0']>;
|
|
51
|
+
/**
|
|
52
|
+
* Per-purpose upload policy registry. Bound to
|
|
53
|
+
* {@link STORAGE_FILE_SIGNED_UPLOAD_POLICIES_TOKEN} and consulted by the
|
|
54
|
+
* `createStorageFileSignedUploadUrl` action to resolve the storage path,
|
|
55
|
+
* allowed content types, and max file size for each purpose.
|
|
56
|
+
*/
|
|
57
|
+
readonly storageFileSignedUploadPolicies: readonly StorageFilePurposeUploadPolicy[];
|
|
41
58
|
}
|
|
42
59
|
/**
|
|
43
60
|
* Convenience function used to generate ModuleMetadata for an app's StorageFileModule.
|