@plyaz/types 1.36.2 → 1.37.1
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/dist/api/index.cjs +10 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.js +10 -1
- package/dist/api/index.js.map +1 -1
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/core/events/index.d.ts +1 -1
- package/dist/core/events/streaming/frameworks.d.ts +154 -0
- package/dist/core/events/streaming/index.d.ts +1 -0
- package/dist/errors/codes.d.ts +2 -0
- package/dist/errors/index.cjs +12 -2
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.js +12 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/observability/datadog-sdk.d.ts +41 -0
- package/dist/observability/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -21,4 +21,4 @@ export { CoreEventScope, SystemEventAction, EntityEventAction, ValidationEventAc
|
|
|
21
21
|
export type { CoreEventScopeType, SystemEventType, EntityEventType, ValidationEventType, SanitizationEventType, ApiEventType, CacheEventType, AuthEventType, DatabaseEventType, FeatureFlagEventType, StoreEventType, CoreEventType, } from './enums';
|
|
22
22
|
export type { CoreEvent, CoreCrudOperation, CoreValidationStartedPayload, CoreValidationSuccessPayload, CoreValidationFailedPayload, CoreSanitizationStartedPayload, CoreSanitizationSuccessPayload, CoreSanitizationFailedPayload, CoreEntityCreatedPayload, CoreEntityUpdatedPayload, CoreEntityPatchedPayload, CoreEntityDeletedPayload, CoreEntityCreatingPayload, CoreEntityUpdatingPayload, CoreEntityPatchingPayload, CoreEntityDeletingPayload, CoreEntityErrorPayload, CoreEntityCompletePayload, CoreBulkCreatedPayload, CoreBulkDeletedPayload, CoreSystemInitializedPayload, CoreSystemReadyPayload, CoreSystemShutdownPayload, CoreSystemErrorPayload, CoreSystemWarningPayload, CoreApiRequestStartPayload, CoreApiRequestSuccessPayload, CoreApiRequestErrorPayload, CoreApiRetryPayload, CoreApiTimeoutPayload, CoreCacheHitPayload, CoreCacheMissPayload, CoreCacheSetPayload, CoreCacheDeletePayload, CoreCacheClearPayload, CoreCacheExpiredPayload, CoreCacheErrorPayload, CoreDatabaseConnectedPayload, CoreDatabaseDisconnectedPayload, CoreDatabaseQueryPayload, CoreDatabaseErrorPayload, CoreDatabaseTransactionStartPayload, CoreDatabaseTransactionCommitPayload, CoreDatabaseTransactionRollbackPayload, CoreAuthLoginPayload, CoreAuthLogoutPayload, CoreAuthTokenRefreshPayload, CoreAuthSessionExpiredPayload, CoreAuthUnauthorizedPayload, CoreFeatureFlagChangedPayload, CoreFeatureFlagEvaluatedPayload, CoreFeatureFlagRefreshedPayload, CoreStoreUpdatedPayload, CoreStoreResetPayload, CoreStoreHydratedPayload, CoreOperationRequestPayload, CoreOperationResultPayload, CoreOperationErrorPayload, CoreStorageUploadedPayload, CoreStorageDownloadedPayload, CoreStorageDeletedPayload, CoreStorageErrorPayload, CoreStorageHealthCheckPayload, CoreNotificationSentPayload, CoreNotificationFailedPayload, CoreNotificationDeliveredPayload, CoreNotificationOpenedPayload, CoreNotificationClickedPayload, CoreNotificationErrorPayload, CoreNotificationHealthCheckPayload, CoreEventPayloadMap, EventPersistenceConfig, DomainPersistenceConfig, PersistOperationConfig, FrontendEventHandlerConfig, DomainFrontendEventConfig, } from './payloads';
|
|
23
23
|
export { STREAM_TRANSPORT, SYSTEM_STREAM_MESSAGE_TYPE, SYSTEM_STREAM_SUBTYPE, SYSTEM_STREAM_CHANNEL, SYSTEM_STREAM_EVENT, STREAM_MESSAGE_TYPE, STREAM_SUBTYPE, STREAM_SCOPE, STREAM_EVENT, STREAM_CHANNEL_PREFIX, STREAM_BROADCAST_CHANNEL, STREAM_PROGRESS_STATUS, FILES_STREAM_MESSAGE_TYPE, FILES_STREAM_SUBTYPE, FILES_STREAM_PROGRESS_STATUS, FILES_STREAM_EVENT, FILES_STREAM_CHANNEL_PREFIX, FILES_STREAM_BROADCAST_CHANNEL, FILES_STREAM_CHANNEL, } from './streaming';
|
|
24
|
-
export type { StreamTransportType, StreamConnection, StreamConnectionInfo, SystemStreamMessageType, SystemStreamSubtype, SystemStreamChannel, StreamMessage, StreamMessageType, StreamMessageSubtype, StreamMessageScope, StreamProgressData, StreamProgressStatus, FilesUploadStreamProgress, FilesDownloadStreamProgress, FilesGenerateStreamProgress, StreamChannel, ChannelSubscription, StreamAuthResult, StreamAuthAdapterConfig, TokenAuthAdapterConfig, StreamTransportAdapterConfig, StreamBroadcasterConfig, StreamManagerStats, UseStreamConnectionOptions, UseStreamConnectionResult, UseStreamManagerOptions, UseStreamManagerResult, StreamResponse, StreamErrorEvent, PaginatedStreamResponse, StreamEndpointConfig, StreamEndpointCreateOptions, StreamBroadcasterInterface, ChannelControllerConfig, StreamMiddlewareContext, StreamMiddlewareResult, StreamMiddleware, RateLimitConfig, StreamEndpointEntry, StreamRegistryConfig, FilesStreamMessageType, FilesStreamSubtype, FilesStreamProgressStatus, FilesStreamProgressData, FilesStreamEventName, FilesStreamChannelPrefix, FilesStreamBroadcastChannel, FilesStreamChannel, } from './streaming';
|
|
24
|
+
export type { StreamTransportType, StreamConnection, StreamConnectionInfo, SystemStreamMessageType, SystemStreamSubtype, SystemStreamChannel, StreamMessage, StreamMessageType, StreamMessageSubtype, StreamMessageScope, StreamProgressData, StreamProgressStatus, FilesUploadStreamProgress, FilesDownloadStreamProgress, FilesGenerateStreamProgress, StreamChannel, ChannelSubscription, StreamAuthResult, StreamAuthAdapterConfig, TokenAuthAdapterConfig, StreamTransportAdapterConfig, StreamBroadcasterConfig, StreamManagerStats, UseStreamConnectionOptions, UseStreamConnectionResult, UseStreamManagerOptions, UseStreamManagerResult, StreamResponse, StreamErrorEvent, PaginatedStreamResponse, StreamEndpointConfig, StreamEndpointCreateOptions, StreamBroadcasterInterface, ChannelControllerConfig, StreamMiddlewareContext, StreamMiddlewareResult, StreamMiddleware, RateLimitConfig, StreamEndpointEntry, StreamRegistryConfig, FilesStreamMessageType, FilesStreamSubtype, FilesStreamProgressStatus, FilesStreamProgressData, FilesStreamEventName, FilesStreamChannelPrefix, FilesStreamBroadcastChannel, FilesStreamChannel, FrameworkType, FrameworkAdapterConfig, FrameworkHandlerOptions, CoreRequestHandler, NextJSHandler, ExpressRequest, ExpressResponse, ExpressHandler, NestJSRequest, NestJSResponse, NestJSHandler, SSEConfig, WebSocketConfig, StreamingModuleServerConfig, StreamingModuleConfig, StreamingModuleAsyncOptions, } from './streaming';
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Adapter Types
|
|
3
|
+
*
|
|
4
|
+
* Types for stream server framework adapters (Next.js, Express, NestJS, etc.).
|
|
5
|
+
* Used to integrate streaming with different web frameworks.
|
|
6
|
+
*/
|
|
7
|
+
import type { StreamTransportType, StreamTransportAdapterConfig, StreamChannel, StreamBroadcasterConfig } from './types';
|
|
8
|
+
import type { StreamEndpointEntry } from './responses';
|
|
9
|
+
/**
|
|
10
|
+
* Supported framework types for streaming adapters
|
|
11
|
+
*/
|
|
12
|
+
export type FrameworkType = 'nextjs' | 'express' | 'nestjs';
|
|
13
|
+
/**
|
|
14
|
+
* Base configuration for framework adapters
|
|
15
|
+
*/
|
|
16
|
+
export interface FrameworkAdapterConfig {
|
|
17
|
+
/** Adapter name for logging */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Whether adapter is enabled */
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options passed to framework handler creation
|
|
24
|
+
*/
|
|
25
|
+
export interface FrameworkHandlerOptions {
|
|
26
|
+
/** Transport type to use (default: 'sse') */
|
|
27
|
+
transport?: StreamTransportType;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Core request handler function type
|
|
31
|
+
* Used internally by the StreamServer
|
|
32
|
+
*/
|
|
33
|
+
export type CoreRequestHandler = (request: Request, transport?: StreamTransportType) => Promise<Response>;
|
|
34
|
+
/**
|
|
35
|
+
* Next.js App Router handler function type
|
|
36
|
+
*/
|
|
37
|
+
export type NextJSHandler = (request: Request) => Promise<Response>;
|
|
38
|
+
/**
|
|
39
|
+
* Express-compatible request interface
|
|
40
|
+
*/
|
|
41
|
+
export interface ExpressRequest {
|
|
42
|
+
/** Request URL */
|
|
43
|
+
url: string;
|
|
44
|
+
/** Request headers */
|
|
45
|
+
headers: Record<string, string | string[] | undefined>;
|
|
46
|
+
/** HTTP method */
|
|
47
|
+
method?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Express-compatible response interface
|
|
51
|
+
*/
|
|
52
|
+
export interface ExpressResponse {
|
|
53
|
+
/** Write HTTP headers */
|
|
54
|
+
writeHead(statusCode: number, headers: Record<string, string>): void;
|
|
55
|
+
/** Write data to response */
|
|
56
|
+
write(chunk: string): boolean;
|
|
57
|
+
/** Listen for events */
|
|
58
|
+
on(event: string, callback: () => void): void;
|
|
59
|
+
/** End the response */
|
|
60
|
+
end(): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Express handler function type
|
|
64
|
+
*/
|
|
65
|
+
export type ExpressHandler = (req: ExpressRequest, res: ExpressResponse) => Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* NestJS-compatible request interface
|
|
68
|
+
*/
|
|
69
|
+
export interface NestJSRequest {
|
|
70
|
+
/** Request URL */
|
|
71
|
+
url: string;
|
|
72
|
+
/** Request headers */
|
|
73
|
+
headers: Record<string, string | string[] | undefined>;
|
|
74
|
+
/** HTTP method */
|
|
75
|
+
method?: string;
|
|
76
|
+
/** Query parameters (permissive for Express ParsedQs compatibility) */
|
|
77
|
+
query?: Record<string, unknown>;
|
|
78
|
+
/** Route parameters */
|
|
79
|
+
params?: Record<string, unknown>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* NestJS-compatible response interface
|
|
83
|
+
*/
|
|
84
|
+
export interface NestJSResponse {
|
|
85
|
+
/** Write HTTP headers */
|
|
86
|
+
writeHead(statusCode: number, headers: Record<string, string>): void;
|
|
87
|
+
/** Set individual header */
|
|
88
|
+
setHeader(name: string, value: string): void;
|
|
89
|
+
/** Set status code */
|
|
90
|
+
status(code: number): this;
|
|
91
|
+
/** Write data to response */
|
|
92
|
+
write(chunk: string): boolean;
|
|
93
|
+
/** Listen for events */
|
|
94
|
+
on(event: string, callback: () => void): void;
|
|
95
|
+
/** End the response */
|
|
96
|
+
end(): void;
|
|
97
|
+
/** Flush headers (optional) */
|
|
98
|
+
flushHeaders?(): void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* NestJS handler function type
|
|
102
|
+
*/
|
|
103
|
+
export type NestJSHandler = (req: NestJSRequest, res: NestJSResponse) => Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* SSE transport configuration for builder
|
|
106
|
+
*/
|
|
107
|
+
export interface SSEConfig extends Partial<StreamTransportAdapterConfig> {
|
|
108
|
+
/** Whether SSE is enabled */
|
|
109
|
+
enabled?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* WebSocket transport configuration for builder
|
|
113
|
+
*/
|
|
114
|
+
export interface WebSocketConfig extends Partial<StreamTransportAdapterConfig> {
|
|
115
|
+
/** Whether WebSocket is enabled */
|
|
116
|
+
enabled?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Server configuration for StreamingModule
|
|
120
|
+
*/
|
|
121
|
+
export interface StreamingModuleServerConfig {
|
|
122
|
+
/** Broadcaster configuration */
|
|
123
|
+
broadcaster?: StreamBroadcasterConfig;
|
|
124
|
+
/** Default channels for new connections */
|
|
125
|
+
defaultChannels?: StreamChannel[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Configuration for NestJS StreamingModule.forRoot()
|
|
129
|
+
*/
|
|
130
|
+
export interface StreamingModuleConfig {
|
|
131
|
+
/** StreamServer configuration */
|
|
132
|
+
server?: StreamingModuleServerConfig;
|
|
133
|
+
/** Stream endpoints to register */
|
|
134
|
+
endpoints?: StreamEndpointEntry[];
|
|
135
|
+
/** Whether module is global (default: true) */
|
|
136
|
+
isGlobal?: boolean;
|
|
137
|
+
/** Include StreamingController (default: true) */
|
|
138
|
+
includeController?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Async configuration options for NestJS StreamingModule.forRootAsync()
|
|
142
|
+
*/
|
|
143
|
+
export interface StreamingModuleAsyncOptions {
|
|
144
|
+
/** Module imports */
|
|
145
|
+
imports?: unknown[];
|
|
146
|
+
/** Factory dependencies to inject */
|
|
147
|
+
inject?: unknown[];
|
|
148
|
+
/** Factory function to create config */
|
|
149
|
+
useFactory: (...args: unknown[]) => StreamingModuleConfig | Promise<StreamingModuleConfig>;
|
|
150
|
+
/** Whether module is global (default: true) */
|
|
151
|
+
isGlobal?: boolean;
|
|
152
|
+
/** Include StreamingController (default: true) */
|
|
153
|
+
includeController?: boolean;
|
|
154
|
+
}
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
export { STREAM_TRANSPORT, SYSTEM_STREAM_MESSAGE_TYPE, SYSTEM_STREAM_SUBTYPE, SYSTEM_STREAM_CHANNEL, SYSTEM_STREAM_EVENT, STREAM_MESSAGE_TYPE, STREAM_SUBTYPE, STREAM_SCOPE, STREAM_EVENT, STREAM_CHANNEL_PREFIX, STREAM_BROADCAST_CHANNEL, STREAM_PROGRESS_STATUS, } from './types';
|
|
15
15
|
export type { StreamTransportType, StreamConnection, StreamConnectionInfo, SystemStreamMessageType, SystemStreamSubtype, SystemStreamChannel, StreamMessage, StreamMessageType, StreamMessageSubtype, StreamMessageScope, StreamProgressData, StreamProgressStatus, FilesUploadStreamProgress, FilesDownloadStreamProgress, FilesGenerateStreamProgress, StreamChannel, ChannelSubscription, StreamAuthResult, StreamAuthAdapterConfig, TokenAuthAdapterConfig, StreamTransportAdapterConfig, StreamBroadcasterConfig, StreamManagerStats, UseStreamConnectionOptions, UseStreamConnectionResult, UseStreamManagerOptions, UseStreamManagerResult, } from './types';
|
|
16
16
|
export type { StreamResponse, StreamErrorEvent, PaginatedStreamResponse, StreamEndpointConfig, StreamEndpointCreateOptions, StreamBroadcasterInterface, ChannelControllerConfig, StreamMiddlewareContext, StreamMiddlewareResult, StreamMiddleware, RateLimitConfig, StreamEndpointEntry, StreamRegistryConfig, } from './responses';
|
|
17
|
+
export type { FrameworkType, FrameworkAdapterConfig, FrameworkHandlerOptions, CoreRequestHandler, NextJSHandler, ExpressRequest, ExpressResponse, ExpressHandler, NestJSRequest, NestJSResponse, NestJSHandler, SSEConfig, WebSocketConfig, StreamingModuleServerConfig, StreamingModuleConfig, StreamingModuleAsyncOptions, } from './frameworks';
|
|
17
18
|
export { FILES_STREAM_MESSAGE_TYPE, FILES_STREAM_SUBTYPE, FILES_STREAM_PROGRESS_STATUS, FILES_STREAM_EVENT, FILES_STREAM_CHANNEL_PREFIX, FILES_STREAM_BROADCAST_CHANNEL, FILES_STREAM_CHANNEL, } from '../../domain/files';
|
|
18
19
|
export type { FilesStreamMessageType, FilesStreamSubtype, FilesStreamProgressStatus, FilesStreamProgressData, FilesStreamEventName, FilesStreamChannelPrefix, FilesStreamBroadcastChannel, FilesStreamChannel, } from '../../domain/files';
|
package/dist/errors/codes.d.ts
CHANGED
|
@@ -533,6 +533,7 @@ export declare const ERROR_CODES: {
|
|
|
533
533
|
readonly STREAM_ENDPOINT_DISABLED: "stream.endpoint.disabled";
|
|
534
534
|
readonly STREAM_UNKNOWN_ERROR: "stream.unknown.error";
|
|
535
535
|
readonly STREAM_INITIALIZATION_FAILED: "stream.initialization.failed";
|
|
536
|
+
readonly STREAM_HANDLER_ERROR: "stream.handler.error";
|
|
536
537
|
};
|
|
537
538
|
/**
|
|
538
539
|
* Type for all error code values
|
|
@@ -1101,6 +1102,7 @@ export declare const STREAM_ERROR_CODES: {
|
|
|
1101
1102
|
readonly ENDPOINT_DISABLED: "stream.endpoint.disabled";
|
|
1102
1103
|
readonly UNKNOWN_ERROR: "stream.unknown.error";
|
|
1103
1104
|
readonly INITIALIZATION_FAILED: "stream.initialization.failed";
|
|
1105
|
+
readonly HANDLER_ERROR: "stream.handler.error";
|
|
1104
1106
|
};
|
|
1105
1107
|
export type ApiErrorCodeValue = (typeof API_ERROR_CODES)[keyof typeof API_ERROR_CODES] | `HTTP_${number}`;
|
|
1106
1108
|
export type NotificationErrorCodeValue = (typeof NOTIFICATION_ERROR_CODES)[keyof typeof NOTIFICATION_ERROR_CODES];
|
package/dist/errors/index.cjs
CHANGED
|
@@ -1024,7 +1024,8 @@ var ERROR_CODES = {
|
|
|
1024
1024
|
STREAM_ENDPOINT_DISABLED: "stream.endpoint.disabled",
|
|
1025
1025
|
// General
|
|
1026
1026
|
STREAM_UNKNOWN_ERROR: "stream.unknown.error",
|
|
1027
|
-
STREAM_INITIALIZATION_FAILED: "stream.initialization.failed"
|
|
1027
|
+
STREAM_INITIALIZATION_FAILED: "stream.initialization.failed",
|
|
1028
|
+
STREAM_HANDLER_ERROR: "stream.handler.error"
|
|
1028
1029
|
};
|
|
1029
1030
|
var API_ERROR_CODES = {
|
|
1030
1031
|
CLIENT_INITIALIZATION_FAILED: ERROR_CODES.CLIENT_INITIALIZATION_FAILED,
|
|
@@ -1633,7 +1634,8 @@ var STREAM_ERROR_CODES = {
|
|
|
1633
1634
|
ENDPOINT_DISABLED: ERROR_CODES.STREAM_ENDPOINT_DISABLED,
|
|
1634
1635
|
// General
|
|
1635
1636
|
UNKNOWN_ERROR: ERROR_CODES.STREAM_UNKNOWN_ERROR,
|
|
1636
|
-
INITIALIZATION_FAILED: ERROR_CODES.STREAM_INITIALIZATION_FAILED
|
|
1637
|
+
INITIALIZATION_FAILED: ERROR_CODES.STREAM_INITIALIZATION_FAILED,
|
|
1638
|
+
HANDLER_ERROR: ERROR_CODES.STREAM_HANDLER_ERROR
|
|
1637
1639
|
};
|
|
1638
1640
|
var ERROR_DEFINITIONS = {
|
|
1639
1641
|
// ===== Generic/Common Error Definitions =====
|
|
@@ -5880,6 +5882,14 @@ var ERROR_DEFINITIONS = {
|
|
|
5880
5882
|
userMessage: "errors.stream.initialization_failed",
|
|
5881
5883
|
severity: ERROR_SEVERITY.Critical,
|
|
5882
5884
|
retryable: true
|
|
5885
|
+
},
|
|
5886
|
+
[ERROR_CODES.STREAM_HANDLER_ERROR]: {
|
|
5887
|
+
code: ERROR_CODES.STREAM_HANDLER_ERROR,
|
|
5888
|
+
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
5889
|
+
category: ERROR_CATEGORY.System,
|
|
5890
|
+
userMessage: "errors.stream.handler_error",
|
|
5891
|
+
severity: ERROR_SEVERITY.High,
|
|
5892
|
+
retryable: true
|
|
5883
5893
|
}
|
|
5884
5894
|
};
|
|
5885
5895
|
|