@webiny/api-core 6.6.0-alpha.1 → 6.6.0-alpha.10
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/ApiCoreFeature.js +6 -2
- package/ApiCoreFeature.js.map +1 -1
- package/exports/api/tasks.d.ts +1 -0
- package/exports/api/tasks.js +1 -1
- package/exports/api.d.ts +1 -1
- package/exports/api.js +1 -1
- package/features/ai/Ai.d.ts +3 -1
- package/features/ai/Ai.js +36 -28
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AiModelRegistry.d.ts +14 -0
- package/features/ai/AiModelRegistry.js +39 -0
- package/features/ai/AiModelRegistry.js.map +1 -0
- package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
- package/features/ai/AiSdkToolHandlerResolver.js +19 -0
- package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
- package/features/ai/AiSdkTools.d.ts +4 -3
- package/features/ai/AiSdkTools.js +11 -9
- package/features/ai/AiSdkTools.js.map +1 -1
- package/features/ai/AnthropicSdkFactory.js +12 -4
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/DEVELOPERS.md +183 -0
- package/features/ai/GoogleSdkFactory.d.ts +10 -0
- package/features/ai/GoogleSdkFactory.js +65 -0
- package/features/ai/GoogleSdkFactory.js.map +1 -0
- package/features/ai/OpenAiSdkFactory.js +51 -11
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
- package/features/ai/OpenRouterSdkFactory.js +112 -0
- package/features/ai/OpenRouterSdkFactory.js.map +1 -0
- package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
- package/features/ai/RemoteAiModelCatalog.js +74 -0
- package/features/ai/RemoteAiModelCatalog.js.map +1 -0
- package/features/ai/abstractions.d.ts +82 -6
- package/features/ai/abstractions.js +6 -2
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/feature.js +10 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +2 -4
- package/features/ai/index.js +1 -1
- package/features/debugger/Debugger.d.ts +30 -0
- package/features/debugger/Debugger.js +142 -0
- package/features/debugger/Debugger.js.map +1 -0
- package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
- package/features/debugger/DebuggerRouteDecorator.js +102 -0
- package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
- package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
- package/features/debugger/GraphQLDebuggerTransport.js +45 -0
- package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
- package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
- package/features/debugger/__tests__/matchNamespace.test.js +68 -0
- package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
- package/features/debugger/__tests__/serialize.test.d.ts +1 -0
- package/features/debugger/__tests__/serialize.test.js +220 -0
- package/features/debugger/__tests__/serialize.test.js.map +1 -0
- package/features/debugger/abstractions.d.ts +100 -0
- package/features/debugger/abstractions.js +6 -0
- package/features/debugger/abstractions.js.map +1 -0
- package/features/debugger/feature.d.ts +5 -0
- package/features/debugger/feature.js +15 -0
- package/features/debugger/feature.js.map +1 -0
- package/features/debugger/index.d.ts +12 -0
- package/features/debugger/index.js +7 -0
- package/features/debugger/limits.d.ts +18 -0
- package/features/debugger/limits.js +11 -0
- package/features/debugger/limits.js.map +1 -0
- package/features/debugger/matchNamespace.d.ts +14 -0
- package/features/debugger/matchNamespace.js +35 -0
- package/features/debugger/matchNamespace.js.map +1 -0
- package/features/debugger/parseNamespaceHeader.d.ts +7 -0
- package/features/debugger/parseNamespaceHeader.js +16 -0
- package/features/debugger/parseNamespaceHeader.js.map +1 -0
- package/features/debugger/permissions.d.ts +14 -0
- package/features/debugger/permissions.js +8 -0
- package/features/debugger/permissions.js.map +1 -0
- package/features/debugger/permissionsSchema.d.ts +17 -0
- package/features/debugger/permissionsSchema.js +18 -0
- package/features/debugger/permissionsSchema.js.map +1 -0
- package/features/debugger/serialize.d.ts +11 -0
- package/features/debugger/serialize.js +121 -0
- package/features/debugger/serialize.js.map +1 -0
- package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
- package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
- package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
- package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
- package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
- package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
- package/features/encryption/EncryptionService.d.ts +3 -2
- package/features/encryption/EncryptionService.js +15 -13
- package/features/encryption/EncryptionService.js.map +1 -1
- package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
- package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
- package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
- package/features/encryption/abstractions.d.ts +26 -0
- package/features/encryption/abstractions.js +3 -1
- package/features/encryption/abstractions.js.map +1 -1
- package/features/encryption/feature.js +2 -0
- package/features/encryption/feature.js.map +1 -1
- package/features/encryption/index.d.ts +3 -0
- package/features/encryption/index.js +3 -1
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +13 -1
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -1
- package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
- package/features/hashing/BuildParamsHashingConfig.js +18 -0
- package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
- package/features/hashing/ScryptHasher.d.ts +2 -2
- package/features/hashing/ScryptHasher.js +6 -8
- package/features/hashing/ScryptHasher.js.map +1 -1
- package/features/hashing/abstractions.d.ts +15 -0
- package/features/hashing/abstractions.js +2 -1
- package/features/hashing/abstractions.js.map +1 -1
- package/features/hashing/feature.js +2 -0
- package/features/hashing/feature.js.map +1 -1
- package/features/hashing/index.d.ts +1 -0
- package/features/hashing/index.js +1 -1
- package/features/httpClient/HttpClient.d.ts +7 -0
- package/features/httpClient/HttpClient.js +72 -0
- package/features/httpClient/HttpClient.js.map +1 -0
- package/features/httpClient/HttpRequestError.d.ts +10 -0
- package/features/httpClient/HttpRequestError.js +13 -0
- package/features/httpClient/HttpRequestError.js.map +1 -0
- package/features/httpClient/HttpStatusError.d.ts +12 -0
- package/features/httpClient/HttpStatusError.js +12 -0
- package/features/httpClient/HttpStatusError.js.map +1 -0
- package/features/httpClient/abstractions.d.ts +32 -0
- package/features/httpClient/abstractions.js +5 -0
- package/features/httpClient/abstractions.js.map +1 -0
- package/features/{logger → httpClient}/feature.d.ts +1 -1
- package/features/httpClient/feature.js +11 -0
- package/features/httpClient/feature.js.map +1 -0
- package/features/httpClient/index.d.ts +3 -0
- package/features/httpClient/index.js +3 -0
- package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
- package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
- package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStore.d.ts +6 -2
- package/features/keyValueStore/KeyValueStore.js +13 -3
- package/features/keyValueStore/KeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
- package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
- package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
- package/features/keyValueStore/abstractions.d.ts +132 -14
- package/features/keyValueStore/abstractions.js.map +1 -1
- package/features/keyValueStore/errors.d.ts +29 -0
- package/features/keyValueStore/errors.js +49 -1
- package/features/keyValueStore/errors.js.map +1 -1
- package/features/keyValueStore/index.d.ts +4 -1
- package/features/keyValueStore/index.js +1 -1
- package/features/logger/NullLogger.d.ts +10 -0
- package/features/logger/NullLogger.js +12 -0
- package/features/logger/NullLogger.js.map +1 -0
- package/features/logger/index.d.ts +1 -0
- package/features/logger/index.js +1 -0
- package/features/publicUrls/NullPublicUrls.d.ts +11 -0
- package/features/publicUrls/NullPublicUrls.js +17 -0
- package/features/publicUrls/NullPublicUrls.js.map +1 -0
- package/features/publicUrls/PublicUrl.d.ts +24 -0
- package/features/publicUrls/PublicUrl.js +43 -0
- package/features/publicUrls/PublicUrl.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
- package/features/publicUrls/abstractions.d.ts +27 -0
- package/features/publicUrls/abstractions.js +5 -0
- package/features/publicUrls/abstractions.js.map +1 -0
- package/features/publicUrls/feature.d.ts +8 -0
- package/features/publicUrls/feature.js +11 -0
- package/features/publicUrls/feature.js.map +1 -0
- package/features/publicUrls/index.d.ts +3 -0
- package/features/publicUrls/index.js +3 -0
- package/features/requestContext/RawAssumePermissions.d.ts +14 -0
- package/features/requestContext/RawAssumePermissions.js +19 -0
- package/features/requestContext/RawAssumePermissions.js.map +1 -0
- package/features/requestContext/abstractions.d.ts +22 -0
- package/features/requestContext/abstractions.js +2 -1
- package/features/requestContext/abstractions.js.map +1 -1
- package/features/requestContext/extractAssumePermissions.d.ts +14 -0
- package/features/requestContext/extractAssumePermissions.js +32 -0
- package/features/requestContext/extractAssumePermissions.js.map +1 -0
- package/features/requestContext/feature.d.ts +2 -1
- package/features/requestContext/feature.js +2 -0
- package/features/requestContext/feature.js.map +1 -1
- package/features/requestContext/index.d.ts +3 -1
- package/features/requestContext/index.js +2 -1
- package/features/security/IdentityContext/IdentityContext.d.ts +6 -2
- package/features/security/IdentityContext/IdentityContext.js +24 -7
- package/features/security/IdentityContext/IdentityContext.js.map +1 -1
- package/features/security/IdentityContext/abstractions.d.ts +6 -1
- package/features/security/IdentityContext/abstractions.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +13 -3
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
- package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/feature.js +6 -1
- package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
- package/features/security/roles/Installer/RolesInstaller.js +1 -0
- package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
- package/features/task/TaskDefinition/abstractions.d.ts +13 -20
- package/features/task/TaskDefinition/abstractions.js.map +1 -1
- package/features/tenancy/TenantContext/TenantContext.d.ts +5 -1
- package/features/tenancy/TenantContext/TenantContext.js +31 -23
- package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
- package/features/users/shared/loaders.js.map +1 -1
- package/features/users/shared/types.d.ts +9 -7
- package/features/wcp/WcpContext/WcpContext.d.ts +6 -1
- package/features/wcp/WcpContext/WcpContext.js +17 -2
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +9 -73
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +25 -5
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/features/wcp/WcpLicenseLoader.js.map +1 -1
- package/features/wcp/resolveWcpProjectEnvironment.d.ts +1 -1
- package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -1
- package/graphql/ApiCoreSchemaFactory.d.ts +1 -0
- package/graphql/ApiCoreSchemaFactory.js +7 -1
- package/graphql/ApiCoreSchemaFactory.js.map +1 -1
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +1 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +4 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -1
- package/graphql/security/SecuritySchemaFactory.d.ts +1 -0
- package/graphql/security/SecuritySchemaFactory.js +4 -0
- package/graphql/security/SecuritySchemaFactory.js.map +1 -1
- package/graphql/system/SystemSchemaFactory.d.ts +1 -0
- package/graphql/system/SystemSchemaFactory.js +4 -0
- package/graphql/system/SystemSchemaFactory.js.map +1 -1
- package/graphql/users/UsersSchemaFactory.d.ts +1 -0
- package/graphql/users/UsersSchemaFactory.js +4 -0
- package/graphql/users/UsersSchemaFactory.js.map +1 -1
- package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
- package/graphql/wcp/WcpSchemaFactory.js +5 -1
- package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
- package/idp/JwksCache.d.ts +14 -3
- package/idp/JwksCache.js +97 -17
- package/idp/JwksCache.js.map +1 -1
- package/idp/JwksStoreFeature.d.ts +8 -0
- package/idp/JwksStoreFeature.js +11 -0
- package/idp/JwksStoreFeature.js.map +1 -0
- package/idp/MemoryJwksStore.d.ts +14 -0
- package/idp/MemoryJwksStore.js +21 -0
- package/idp/MemoryJwksStore.js.map +1 -0
- package/idp/OidcJwtIdentityProvider.js +5 -1
- package/idp/OidcJwtIdentityProvider.js.map +1 -1
- package/idp/abstractions.d.ts +24 -0
- package/idp/abstractions.js +2 -1
- package/idp/abstractions.js.map +1 -1
- package/idp/feature.js +1 -2
- package/idp/feature.js.map +1 -1
- package/idp/index.d.ts +1 -0
- package/idp/index.js +1 -0
- package/package.json +21 -21
- package/types/users.d.ts +2 -3
- package/features/logger/LoggerService.d.ts +0 -14
- package/features/logger/LoggerService.js +0 -48
- package/features/logger/LoggerService.js.map +0 -1
- package/features/logger/feature.js +0 -11
- package/features/logger/feature.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DebuggerTransport as DebuggerTransportAbstraction } from "./abstractions.js";
|
|
2
|
+
import type { IDebugDeliveryTarget } from "./abstractions.js";
|
|
3
|
+
import type { IDebuggerTransportDeliverParams } from "./abstractions.js";
|
|
4
|
+
export declare const GRAPHQL_TARGET = "graphql";
|
|
5
|
+
export interface IGraphQLDeliveryTarget extends IDebugDeliveryTarget {
|
|
6
|
+
type: typeof GRAPHQL_TARGET;
|
|
7
|
+
/**
|
|
8
|
+
* Already resolved to a single result object - never the array. Batched requests are reduced to
|
|
9
|
+
* their last element by the route decorator, so this transport never has to know about batching.
|
|
10
|
+
*/
|
|
11
|
+
result: Record<string, any>;
|
|
12
|
+
requestId: string;
|
|
13
|
+
operations: string[];
|
|
14
|
+
url: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Writes a finished session into the GraphQL response's `extensions` property.
|
|
18
|
+
*/
|
|
19
|
+
export declare class GraphQLDebuggerTransportImpl implements DebuggerTransportAbstraction.Interface {
|
|
20
|
+
canDeliver(target: IDebugDeliveryTarget): boolean;
|
|
21
|
+
deliver({ target, session }: IDebuggerTransportDeliverParams): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Merges a value under `extensions.debug`, never assigning `extensions` wholesale - other plugins
|
|
25
|
+
* write to it too.
|
|
26
|
+
*/
|
|
27
|
+
export declare const writeExtension: (result: Record<string, any>, debug: Record<string, any>) => void;
|
|
28
|
+
export declare const GraphQLDebuggerTransport: import("@webiny/di").Implementation<typeof GraphQLDebuggerTransportImpl>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/feature/api";
|
|
2
|
+
import { DebuggerTransport } from "./abstractions.js";
|
|
3
|
+
const GRAPHQL_TARGET = "graphql";
|
|
4
|
+
const isGraphQLTarget = (target)=>target.type === GRAPHQL_TARGET;
|
|
5
|
+
class GraphQLDebuggerTransportImpl {
|
|
6
|
+
canDeliver(target) {
|
|
7
|
+
return isGraphQLTarget(target);
|
|
8
|
+
}
|
|
9
|
+
deliver({ target, session }) {
|
|
10
|
+
if (!isGraphQLTarget(target)) return;
|
|
11
|
+
if (0 === session.entries.length) return;
|
|
12
|
+
const entries = session.entries.map((entry)=>({
|
|
13
|
+
seq: entry.seq,
|
|
14
|
+
namespace: entry.namespace,
|
|
15
|
+
timestamp: entry.timestamp,
|
|
16
|
+
elapsed: entry.elapsed,
|
|
17
|
+
data: JSON.parse(entry.json)
|
|
18
|
+
}));
|
|
19
|
+
writeExtension(target.result, {
|
|
20
|
+
enabled: true,
|
|
21
|
+
requestId: target.requestId,
|
|
22
|
+
url: target.url,
|
|
23
|
+
namespaces: session.namespaces,
|
|
24
|
+
operations: target.operations,
|
|
25
|
+
entries,
|
|
26
|
+
bytes: session.bytes,
|
|
27
|
+
dropped: session.dropped,
|
|
28
|
+
truncated: session.truncated
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const writeExtension = (result, debug)=>{
|
|
33
|
+
result.extensions = {
|
|
34
|
+
...result.extensions,
|
|
35
|
+
debug
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const GraphQLDebuggerTransport = createImplementation({
|
|
39
|
+
abstraction: DebuggerTransport,
|
|
40
|
+
implementation: GraphQLDebuggerTransportImpl,
|
|
41
|
+
dependencies: []
|
|
42
|
+
});
|
|
43
|
+
export { GRAPHQL_TARGET, GraphQLDebuggerTransport, GraphQLDebuggerTransportImpl, writeExtension };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=GraphQLDebuggerTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/debugger/GraphQLDebuggerTransport.js","sources":["../../../src/features/debugger/GraphQLDebuggerTransport.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { DebuggerTransport as DebuggerTransportAbstraction } from \"./abstractions.js\";\nimport type { IDebugDeliveryTarget } from \"./abstractions.js\";\nimport type { IDebuggerTransportDeliverParams } from \"./abstractions.js\";\n\nexport const GRAPHQL_TARGET = \"graphql\";\n\nexport interface IGraphQLDeliveryTarget extends IDebugDeliveryTarget {\n type: typeof GRAPHQL_TARGET;\n /**\n * Already resolved to a single result object - never the array. Batched requests are reduced to\n * their last element by the route decorator, so this transport never has to know about batching.\n */\n result: Record<string, any>;\n requestId: string;\n operations: string[];\n url: string;\n}\n\nconst isGraphQLTarget = (target: IDebugDeliveryTarget): target is IGraphQLDeliveryTarget => {\n return target.type === GRAPHQL_TARGET;\n};\n\n/**\n * Writes a finished session into the GraphQL response's `extensions` property.\n */\nexport class GraphQLDebuggerTransportImpl implements DebuggerTransportAbstraction.Interface {\n public canDeliver(target: IDebugDeliveryTarget): boolean {\n return isGraphQLTarget(target);\n }\n\n public deliver({ target, session }: IDebuggerTransportDeliverParams): void {\n if (!isGraphQLTarget(target)) {\n return;\n }\n\n /**\n * Nothing matched the filter on this request. Writing an envelope with an empty `entries`\n * array would put a payload on every response for no benefit, and give whoever reads the\n * report a pile of blanks to scroll past.\n */\n if (session.entries.length === 0) {\n return;\n }\n\n const entries = session.entries.map(entry => {\n return {\n seq: entry.seq,\n namespace: entry.namespace,\n timestamp: entry.timestamp,\n elapsed: entry.elapsed,\n /**\n * Entries are buffered as strings so the payload graph can be released at capture\n * time. Parsing here is what puts structured data in the response rather than JSON\n * inside JSON.\n */\n data: JSON.parse(entry.json)\n };\n });\n\n writeExtension(target.result, {\n enabled: true,\n requestId: target.requestId,\n url: target.url,\n namespaces: session.namespaces,\n operations: target.operations,\n entries,\n bytes: session.bytes,\n dropped: session.dropped,\n truncated: session.truncated\n });\n }\n}\n\n/**\n * Merges a value under `extensions.debug`, never assigning `extensions` wholesale - other plugins\n * write to it too.\n */\nexport const writeExtension = (result: Record<string, any>, debug: Record<string, any>): void => {\n result.extensions = { ...result.extensions, debug };\n};\n\nexport const GraphQLDebuggerTransport = createImplementation({\n abstraction: DebuggerTransportAbstraction,\n implementation: GraphQLDebuggerTransportImpl,\n dependencies: []\n});\n"],"names":["GRAPHQL_TARGET","isGraphQLTarget","target","GraphQLDebuggerTransportImpl","session","entries","entry","JSON","writeExtension","result","debug","GraphQLDebuggerTransport","createImplementation","DebuggerTransportAbstraction"],"mappings":";;AAKO,MAAMA,iBAAiB;AAc9B,MAAMC,kBAAkB,CAACC,SACdA,OAAO,IAAI,KAAKF;AAMpB,MAAMG;IACF,WAAWD,MAA4B,EAAW;QACrD,OAAOD,gBAAgBC;IAC3B;IAEO,QAAQ,EAAEA,MAAM,EAAEE,OAAO,EAAmC,EAAQ;QACvE,IAAI,CAACH,gBAAgBC,SACjB;QAQJ,IAAIE,AAA2B,MAA3BA,QAAQ,OAAO,CAAC,MAAM,EACtB;QAGJ,MAAMC,UAAUD,QAAQ,OAAO,CAAC,GAAG,CAACE,CAAAA,QACzB;gBACH,KAAKA,MAAM,GAAG;gBACd,WAAWA,MAAM,SAAS;gBAC1B,WAAWA,MAAM,SAAS;gBAC1B,SAASA,MAAM,OAAO;gBAMtB,MAAMC,KAAK,KAAK,CAACD,MAAM,IAAI;YAC/B;QAGJE,eAAeN,OAAO,MAAM,EAAE;YAC1B,SAAS;YACT,WAAWA,OAAO,SAAS;YAC3B,KAAKA,OAAO,GAAG;YACf,YAAYE,QAAQ,UAAU;YAC9B,YAAYF,OAAO,UAAU;YAC7BG;YACA,OAAOD,QAAQ,KAAK;YACpB,SAASA,QAAQ,OAAO;YACxB,WAAWA,QAAQ,SAAS;QAChC;IACJ;AACJ;AAMO,MAAMI,iBAAiB,CAACC,QAA6BC;IACxDD,OAAO,UAAU,GAAG;QAAE,GAAGA,OAAO,UAAU;QAAEC;IAAM;AACtD;AAEO,MAAMC,2BAA2BC,qBAAqB;IACzD,aAAaC;IACb,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createNamespaceFilter } from "../matchNamespace.js";
|
|
3
|
+
import { parseNamespaceHeader } from "../parseNamespaceHeader.js";
|
|
4
|
+
describe("parseNamespaceHeader", ()=>{
|
|
5
|
+
it("should not start a session when the header is absent or empty", ()=>{
|
|
6
|
+
expect(parseNamespaceHeader(void 0)).toEqual([]);
|
|
7
|
+
expect(parseNamespaceHeader("")).toEqual([]);
|
|
8
|
+
expect(parseNamespaceHeader(" ")).toEqual([]);
|
|
9
|
+
});
|
|
10
|
+
it("should treat the truthy shorthands as capture-all", ()=>{
|
|
11
|
+
expect(parseNamespaceHeader("1")).toEqual([
|
|
12
|
+
"*"
|
|
13
|
+
]);
|
|
14
|
+
expect(parseNamespaceHeader("true")).toEqual([
|
|
15
|
+
"*"
|
|
16
|
+
]);
|
|
17
|
+
expect(parseNamespaceHeader("*")).toEqual([
|
|
18
|
+
"*"
|
|
19
|
+
]);
|
|
20
|
+
});
|
|
21
|
+
it("should trim tokens, since duplicate headers arrive comma-joined with spaces", ()=>{
|
|
22
|
+
expect(parseNamespaceHeader("cms.os.*, fm.*")).toEqual([
|
|
23
|
+
"cms.os.*",
|
|
24
|
+
"fm.*"
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
it("should accept the array form of a repeated header", ()=>{
|
|
28
|
+
expect(parseNamespaceHeader([
|
|
29
|
+
"cms.os.*",
|
|
30
|
+
"fm.*"
|
|
31
|
+
])).toEqual([
|
|
32
|
+
"cms.os.*",
|
|
33
|
+
"fm.*"
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("createNamespaceFilter", ()=>{
|
|
38
|
+
it("should match everything for the wildcard", ()=>{
|
|
39
|
+
const filter = createNamespaceFilter([
|
|
40
|
+
"*"
|
|
41
|
+
]);
|
|
42
|
+
expect(filter.matches("cms.os.list")).toBe(true);
|
|
43
|
+
expect(filter.matches("core.anything")).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
it("should match a prefix glob across dots", ()=>{
|
|
46
|
+
const filter = createNamespaceFilter([
|
|
47
|
+
"cms.*"
|
|
48
|
+
]);
|
|
49
|
+
expect(filter.matches("cms.os.list")).toBe(true);
|
|
50
|
+
expect(filter.matches("fm.file.get")).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
it("should exclude rather than invert on negation", ()=>{
|
|
53
|
+
const filter = createNamespaceFilter([
|
|
54
|
+
"*",
|
|
55
|
+
"!cms.os.*"
|
|
56
|
+
]);
|
|
57
|
+
expect(filter.matches("cms.os.list")).toBe(false);
|
|
58
|
+
expect(filter.matches("fm.file.get")).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
it("should require at least one positive match", ()=>{
|
|
61
|
+
const filter = createNamespaceFilter([
|
|
62
|
+
"!cms.os.*"
|
|
63
|
+
]);
|
|
64
|
+
expect(filter.matches("fm.file.get")).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=matchNamespace.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/debugger/__tests__/matchNamespace.test.js","sources":["../../../../src/features/debugger/__tests__/matchNamespace.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { createNamespaceFilter } from \"../matchNamespace.js\";\nimport { parseNamespaceHeader } from \"../parseNamespaceHeader.js\";\n\ndescribe(\"parseNamespaceHeader\", () => {\n it(\"should not start a session when the header is absent or empty\", () => {\n expect(parseNamespaceHeader(undefined)).toEqual([]);\n expect(parseNamespaceHeader(\"\")).toEqual([]);\n expect(parseNamespaceHeader(\" \")).toEqual([]);\n });\n\n it(\"should treat the truthy shorthands as capture-all\", () => {\n expect(parseNamespaceHeader(\"1\")).toEqual([\"*\"]);\n expect(parseNamespaceHeader(\"true\")).toEqual([\"*\"]);\n expect(parseNamespaceHeader(\"*\")).toEqual([\"*\"]);\n });\n\n it(\"should trim tokens, since duplicate headers arrive comma-joined with spaces\", () => {\n expect(parseNamespaceHeader(\"cms.os.*, fm.*\")).toEqual([\"cms.os.*\", \"fm.*\"]);\n });\n\n it(\"should accept the array form of a repeated header\", () => {\n expect(parseNamespaceHeader([\"cms.os.*\", \"fm.*\"])).toEqual([\"cms.os.*\", \"fm.*\"]);\n });\n});\n\ndescribe(\"createNamespaceFilter\", () => {\n it(\"should match everything for the wildcard\", () => {\n const filter = createNamespaceFilter([\"*\"]);\n\n expect(filter.matches(\"cms.os.list\")).toBe(true);\n expect(filter.matches(\"core.anything\")).toBe(true);\n });\n\n it(\"should match a prefix glob across dots\", () => {\n const filter = createNamespaceFilter([\"cms.*\"]);\n\n expect(filter.matches(\"cms.os.list\")).toBe(true);\n expect(filter.matches(\"fm.file.get\")).toBe(false);\n });\n\n it(\"should exclude rather than invert on negation\", () => {\n const filter = createNamespaceFilter([\"*\", \"!cms.os.*\"]);\n\n expect(filter.matches(\"cms.os.list\")).toBe(false);\n expect(filter.matches(\"fm.file.get\")).toBe(true);\n });\n\n it(\"should require at least one positive match\", () => {\n const filter = createNamespaceFilter([\"!cms.os.*\"]);\n\n expect(filter.matches(\"fm.file.get\")).toBe(false);\n });\n});\n"],"names":["describe","it","expect","parseNamespaceHeader","undefined","filter","createNamespaceFilter"],"mappings":";;;AAIAA,SAAS,wBAAwB;IAC7BC,GAAG,iEAAiE;QAChEC,OAAOC,qBAAqBC,SAAY,OAAO,CAAC,EAAE;QAClDF,OAAOC,qBAAqB,KAAK,OAAO,CAAC,EAAE;QAC3CD,OAAOC,qBAAqB,QAAQ,OAAO,CAAC,EAAE;IAClD;IAEAF,GAAG,qDAAqD;QACpDC,OAAOC,qBAAqB,MAAM,OAAO,CAAC;YAAC;SAAI;QAC/CD,OAAOC,qBAAqB,SAAS,OAAO,CAAC;YAAC;SAAI;QAClDD,OAAOC,qBAAqB,MAAM,OAAO,CAAC;YAAC;SAAI;IACnD;IAEAF,GAAG,+EAA+E;QAC9EC,OAAOC,qBAAqB,mBAAmB,OAAO,CAAC;YAAC;YAAY;SAAO;IAC/E;IAEAF,GAAG,qDAAqD;QACpDC,OAAOC,qBAAqB;YAAC;YAAY;SAAO,GAAG,OAAO,CAAC;YAAC;YAAY;SAAO;IACnF;AACJ;AAEAH,SAAS,yBAAyB;IAC9BC,GAAG,4CAA4C;QAC3C,MAAMI,SAASC,sBAAsB;YAAC;SAAI;QAE1CJ,OAAOG,OAAO,OAAO,CAAC,gBAAgB,IAAI,CAAC;QAC3CH,OAAOG,OAAO,OAAO,CAAC,kBAAkB,IAAI,CAAC;IACjD;IAEAJ,GAAG,0CAA0C;QACzC,MAAMI,SAASC,sBAAsB;YAAC;SAAQ;QAE9CJ,OAAOG,OAAO,OAAO,CAAC,gBAAgB,IAAI,CAAC;QAC3CH,OAAOG,OAAO,OAAO,CAAC,gBAAgB,IAAI,CAAC;IAC/C;IAEAJ,GAAG,iDAAiD;QAChD,MAAMI,SAASC,sBAAsB;YAAC;YAAK;SAAY;QAEvDJ,OAAOG,OAAO,OAAO,CAAC,gBAAgB,IAAI,CAAC;QAC3CH,OAAOG,OAAO,OAAO,CAAC,gBAAgB,IAAI,CAAC;IAC/C;IAEAJ,GAAG,8CAA8C;QAC7C,MAAMI,SAASC,sBAAsB;YAAC;SAAY;QAElDJ,OAAOG,OAAO,OAAO,CAAC,gBAAgB,IAAI,CAAC;IAC/C;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { serialize } from "../serialize.js";
|
|
3
|
+
import { DEFAULT_LIMITS } from "../limits.js";
|
|
4
|
+
const limits = (overrides = {})=>({
|
|
5
|
+
...DEFAULT_LIMITS,
|
|
6
|
+
...overrides
|
|
7
|
+
});
|
|
8
|
+
const parse = (value, overrides = {})=>{
|
|
9
|
+
const result = serialize(value, limits(overrides));
|
|
10
|
+
return {
|
|
11
|
+
...result,
|
|
12
|
+
parsed: JSON.parse(result.json)
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
describe("serialize", ()=>{
|
|
16
|
+
it("should always produce parseable JSON", ()=>{
|
|
17
|
+
const circular = {
|
|
18
|
+
name: "root"
|
|
19
|
+
};
|
|
20
|
+
circular.self = circular;
|
|
21
|
+
const { parsed } = parse(circular);
|
|
22
|
+
expect(parsed).toEqual({
|
|
23
|
+
name: "root",
|
|
24
|
+
self: "#[Circular]"
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
it("should not report siblings as circular", ()=>{
|
|
28
|
+
const shared = {
|
|
29
|
+
id: 1
|
|
30
|
+
};
|
|
31
|
+
const { parsed } = parse({
|
|
32
|
+
a: shared,
|
|
33
|
+
b: shared
|
|
34
|
+
});
|
|
35
|
+
expect(parsed).toEqual({
|
|
36
|
+
a: {
|
|
37
|
+
id: 1
|
|
38
|
+
},
|
|
39
|
+
b: {
|
|
40
|
+
id: 1
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it("should serialize an Error, which JSON.stringify renders as an empty object", ()=>{
|
|
45
|
+
const error = new Error("Boom");
|
|
46
|
+
const { parsed } = parse({
|
|
47
|
+
error
|
|
48
|
+
});
|
|
49
|
+
expect(parsed.error.name).toBe("Error");
|
|
50
|
+
expect(parsed.error.message).toBe("Boom");
|
|
51
|
+
expect(typeof parsed.error.stack).toBe("string");
|
|
52
|
+
});
|
|
53
|
+
it("should serialize a BigInt, which JSON.stringify throws on", ()=>{
|
|
54
|
+
const { parsed } = parse({
|
|
55
|
+
value: BigInt(123)
|
|
56
|
+
});
|
|
57
|
+
expect(parsed).toEqual({
|
|
58
|
+
value: "123n"
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
it("should describe binary data without including its contents", ()=>{
|
|
62
|
+
const { parsed } = parse({
|
|
63
|
+
buffer: Buffer.from("hello world")
|
|
64
|
+
});
|
|
65
|
+
expect(parsed).toEqual({
|
|
66
|
+
buffer: "#[Buffer 11 bytes]"
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
it("should serialize Map and Set", ()=>{
|
|
70
|
+
const { parsed } = parse({
|
|
71
|
+
map: new Map([
|
|
72
|
+
[
|
|
73
|
+
"a",
|
|
74
|
+
1
|
|
75
|
+
]
|
|
76
|
+
]),
|
|
77
|
+
set: new Set([
|
|
78
|
+
1,
|
|
79
|
+
2
|
|
80
|
+
])
|
|
81
|
+
});
|
|
82
|
+
expect(parsed.map).toEqual({
|
|
83
|
+
__type: "Map",
|
|
84
|
+
entries: [
|
|
85
|
+
[
|
|
86
|
+
"a",
|
|
87
|
+
1
|
|
88
|
+
]
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
expect(parsed.set).toEqual({
|
|
92
|
+
__type: "Set",
|
|
93
|
+
items: [
|
|
94
|
+
1,
|
|
95
|
+
2
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
it("should drop an undefined property, so a logged payload matches what was sent", ()=>{
|
|
100
|
+
const { parsed } = parse({
|
|
101
|
+
kept: 1,
|
|
102
|
+
dropped: void 0
|
|
103
|
+
});
|
|
104
|
+
expect(parsed).toEqual({
|
|
105
|
+
kept: 1
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
it("should keep undefined array elements, where dropping would shift every later index", ()=>{
|
|
109
|
+
const { parsed } = parse({
|
|
110
|
+
items: [
|
|
111
|
+
1,
|
|
112
|
+
void 0,
|
|
113
|
+
3
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
expect(parsed).toEqual({
|
|
117
|
+
items: [
|
|
118
|
+
1,
|
|
119
|
+
"#[Undefined value]",
|
|
120
|
+
3
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
it("should not throw when a getter throws", ()=>{
|
|
125
|
+
const value = {
|
|
126
|
+
get exploding () {
|
|
127
|
+
throw new Error("Nope");
|
|
128
|
+
},
|
|
129
|
+
safe: 1
|
|
130
|
+
};
|
|
131
|
+
const { parsed } = parse(value);
|
|
132
|
+
expect(parsed.exploding).toBe("#[Throws: Nope]");
|
|
133
|
+
expect(parsed.safe).toBe(1);
|
|
134
|
+
});
|
|
135
|
+
it("should cap depth", ()=>{
|
|
136
|
+
const { parsed } = parse({
|
|
137
|
+
a: {
|
|
138
|
+
b: {
|
|
139
|
+
c: {
|
|
140
|
+
d: "deep"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
depth: 2
|
|
146
|
+
});
|
|
147
|
+
expect(parsed).toEqual({
|
|
148
|
+
a: {
|
|
149
|
+
b: "#[Depth limit]"
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
it("should cap string length and say how much was cut", ()=>{
|
|
154
|
+
const { parsed } = parse({
|
|
155
|
+
text: "x".repeat(20)
|
|
156
|
+
}, {
|
|
157
|
+
stringLength: 5
|
|
158
|
+
});
|
|
159
|
+
expect(parsed).toEqual({
|
|
160
|
+
text: "xxxxx…(15 more)"
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
it("should cap array length and say how much was cut", ()=>{
|
|
164
|
+
const { parsed } = parse({
|
|
165
|
+
items: [
|
|
166
|
+
1,
|
|
167
|
+
2,
|
|
168
|
+
3,
|
|
169
|
+
4,
|
|
170
|
+
5
|
|
171
|
+
]
|
|
172
|
+
}, {
|
|
173
|
+
arrayLength: 2
|
|
174
|
+
});
|
|
175
|
+
expect(parsed).toEqual({
|
|
176
|
+
items: [
|
|
177
|
+
1,
|
|
178
|
+
2,
|
|
179
|
+
"…(3 more items)"
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
it("should replace the payload wholesale when it exceeds the per-entry cap", ()=>{
|
|
184
|
+
const result = parse({
|
|
185
|
+
text: "x".repeat(5000)
|
|
186
|
+
}, {
|
|
187
|
+
entryBytes: 100,
|
|
188
|
+
stringLength: 100000
|
|
189
|
+
});
|
|
190
|
+
expect(result.truncated).toBe(true);
|
|
191
|
+
expect(result.parsed.truncated).toBe(true);
|
|
192
|
+
expect(result.parsed.originalBytes).toBeGreaterThan(100);
|
|
193
|
+
expect(result.bytes).toBeLessThanOrEqual(100);
|
|
194
|
+
});
|
|
195
|
+
it("should never invoke a custom toJSON, so it cannot be broken by one", ()=>{
|
|
196
|
+
const value = {
|
|
197
|
+
id: 1,
|
|
198
|
+
toJSON () {
|
|
199
|
+
throw new Error("Nope");
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const { parsed } = parse({
|
|
203
|
+
value
|
|
204
|
+
});
|
|
205
|
+
expect(parsed.value.id).toBe(1);
|
|
206
|
+
expect(parsed.value.toJSON).toBe("#[Function: toJSON]");
|
|
207
|
+
});
|
|
208
|
+
it("should keep non-finite numbers readable instead of turning them into null", ()=>{
|
|
209
|
+
const { parsed } = parse({
|
|
210
|
+
a: 1 / 0,
|
|
211
|
+
b: 0 / 0
|
|
212
|
+
});
|
|
213
|
+
expect(parsed).toEqual({
|
|
214
|
+
a: "Infinity",
|
|
215
|
+
b: "NaN"
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
//# sourceMappingURL=serialize.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/debugger/__tests__/serialize.test.js","sources":["../../../../src/features/debugger/__tests__/serialize.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { serialize } from \"../serialize.js\";\nimport { DEFAULT_LIMITS, type IDebuggerLimits } from \"../limits.js\";\n\nconst limits = (overrides: Partial<IDebuggerLimits> = {}): IDebuggerLimits => {\n return { ...DEFAULT_LIMITS, ...overrides };\n};\n\nconst parse = (value: unknown, overrides: Partial<IDebuggerLimits> = {}) => {\n const result = serialize(value, limits(overrides));\n return { ...result, parsed: JSON.parse(result.json) };\n};\n\ndescribe(\"serialize\", () => {\n it(\"should always produce parseable JSON\", () => {\n const circular: Record<string, unknown> = { name: \"root\" };\n circular.self = circular;\n\n const { parsed } = parse(circular);\n\n expect(parsed).toEqual({ name: \"root\", self: \"#[Circular]\" });\n });\n\n it(\"should not report siblings as circular\", () => {\n const shared = { id: 1 };\n\n const { parsed } = parse({ a: shared, b: shared });\n\n expect(parsed).toEqual({ a: { id: 1 }, b: { id: 1 } });\n });\n\n it(\"should serialize an Error, which JSON.stringify renders as an empty object\", () => {\n const error = new Error(\"Boom\");\n\n const { parsed } = parse({ error });\n\n expect(parsed.error.name).toBe(\"Error\");\n expect(parsed.error.message).toBe(\"Boom\");\n expect(typeof parsed.error.stack).toBe(\"string\");\n });\n\n it(\"should serialize a BigInt, which JSON.stringify throws on\", () => {\n const { parsed } = parse({ value: BigInt(123) });\n\n expect(parsed).toEqual({ value: \"123n\" });\n });\n\n it(\"should describe binary data without including its contents\", () => {\n const { parsed } = parse({ buffer: Buffer.from(\"hello world\") });\n\n expect(parsed).toEqual({ buffer: \"#[Buffer 11 bytes]\" });\n });\n\n it(\"should serialize Map and Set\", () => {\n const { parsed } = parse({\n map: new Map([[\"a\", 1]]),\n set: new Set([1, 2])\n });\n\n expect(parsed.map).toEqual({ __type: \"Map\", entries: [[\"a\", 1]] });\n expect(parsed.set).toEqual({ __type: \"Set\", items: [1, 2] });\n });\n\n it(\"should drop an undefined property, so a logged payload matches what was sent\", () => {\n const { parsed } = parse({ kept: 1, dropped: undefined });\n\n expect(parsed).toEqual({ kept: 1 });\n });\n\n it(\"should keep undefined array elements, where dropping would shift every later index\", () => {\n const { parsed } = parse({ items: [1, undefined, 3] });\n\n expect(parsed).toEqual({ items: [1, \"#[Undefined value]\", 3] });\n });\n\n it(\"should not throw when a getter throws\", () => {\n const value = {\n get exploding() {\n throw new Error(\"Nope\");\n },\n safe: 1\n };\n\n const { parsed } = parse(value);\n\n expect(parsed.exploding).toBe(\"#[Throws: Nope]\");\n expect(parsed.safe).toBe(1);\n });\n\n it(\"should cap depth\", () => {\n const { parsed } = parse({ a: { b: { c: { d: \"deep\" } } } }, { depth: 2 });\n\n expect(parsed).toEqual({ a: { b: \"#[Depth limit]\" } });\n });\n\n it(\"should cap string length and say how much was cut\", () => {\n const { parsed } = parse({ text: \"x\".repeat(20) }, { stringLength: 5 });\n\n expect(parsed).toEqual({ text: \"xxxxx…(15 more)\" });\n });\n\n it(\"should cap array length and say how much was cut\", () => {\n const { parsed } = parse({ items: [1, 2, 3, 4, 5] }, { arrayLength: 2 });\n\n expect(parsed).toEqual({ items: [1, 2, \"…(3 more items)\"] });\n });\n\n it(\"should replace the payload wholesale when it exceeds the per-entry cap\", () => {\n const result = parse({ text: \"x\".repeat(5000) }, { entryBytes: 100, stringLength: 100000 });\n\n expect(result.truncated).toBe(true);\n expect(result.parsed.truncated).toBe(true);\n expect(result.parsed.originalBytes).toBeGreaterThan(100);\n expect(result.bytes).toBeLessThanOrEqual(100);\n });\n\n it(\"should never invoke a custom toJSON, so it cannot be broken by one\", () => {\n const value = {\n id: 1,\n toJSON() {\n throw new Error(\"Nope\");\n }\n };\n\n const { parsed } = parse({ value });\n\n expect(parsed.value.id).toBe(1);\n expect(parsed.value.toJSON).toBe(\"#[Function: toJSON]\");\n });\n\n it(\"should keep non-finite numbers readable instead of turning them into null\", () => {\n const { parsed } = parse({ a: Infinity, b: NaN });\n\n expect(parsed).toEqual({ a: \"Infinity\", b: \"NaN\" });\n });\n});\n"],"names":["limits","overrides","DEFAULT_LIMITS","parse","value","result","serialize","JSON","describe","it","circular","parsed","expect","shared","error","Error","BigInt","Buffer","Map","Set","undefined","Infinity","NaN"],"mappings":"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"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry of debug namespace prefixes.
|
|
3
|
+
*
|
|
4
|
+
* Packages augment this interface to claim their own prefix:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* declare module "@webiny/api-core/features/debugger/abstractions.js" {
|
|
8
|
+
* interface DebugNamespaces {
|
|
9
|
+
* cms: `cms.${string}`;
|
|
10
|
+
* }
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The module specifier must be exactly the one above - a relative path augments nothing.
|
|
15
|
+
*/
|
|
16
|
+
export interface DebugNamespaces {
|
|
17
|
+
core: `core.${string}`;
|
|
18
|
+
}
|
|
19
|
+
export type DebugNamespace = DebugNamespaces[keyof DebugNamespaces];
|
|
20
|
+
/**
|
|
21
|
+
* Produces the payload to capture. Invoked only when capture is active, so building an expensive
|
|
22
|
+
* payload costs nothing when the debugger is off.
|
|
23
|
+
*/
|
|
24
|
+
export interface IDebugPayloadFactory {
|
|
25
|
+
(): unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface IDebugEntry {
|
|
28
|
+
seq: number;
|
|
29
|
+
namespace: string;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
/** Milliseconds since the session started. */
|
|
32
|
+
elapsed: number;
|
|
33
|
+
/** Already serialized and capped. Valid JSON. */
|
|
34
|
+
json: string;
|
|
35
|
+
bytes: number;
|
|
36
|
+
}
|
|
37
|
+
export interface IDebugSession {
|
|
38
|
+
namespaces: string[];
|
|
39
|
+
startedAt: number;
|
|
40
|
+
entries: IDebugEntry[];
|
|
41
|
+
bytes: number;
|
|
42
|
+
/** Entries discarded from the front of the buffer because the total budget was exceeded. */
|
|
43
|
+
dropped: number;
|
|
44
|
+
/** True once any single entry's payload was replaced by the per-entry cap marker. */
|
|
45
|
+
truncated: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface IDebuggerStartParams {
|
|
48
|
+
namespaces: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface IDebugDeliveryTarget {
|
|
51
|
+
type: string;
|
|
52
|
+
}
|
|
53
|
+
export interface IDebuggerTransportDeliverParams {
|
|
54
|
+
target: IDebugDeliveryTarget;
|
|
55
|
+
session: IDebugSession;
|
|
56
|
+
}
|
|
57
|
+
export interface IDebugger {
|
|
58
|
+
/**
|
|
59
|
+
* Opens a capture session, replacing any existing one.
|
|
60
|
+
*/
|
|
61
|
+
start(params: IDebuggerStartParams): void;
|
|
62
|
+
/**
|
|
63
|
+
* Captures a payload, if a session is open and the namespace matches its filter.
|
|
64
|
+
* Never throws.
|
|
65
|
+
*/
|
|
66
|
+
log(namespace: DebugNamespace, payload: IDebugPayloadFactory): void;
|
|
67
|
+
/**
|
|
68
|
+
* Whether a namespace would currently be captured. For guarding expensive work *around* a log
|
|
69
|
+
* call - `log` already performs this check itself.
|
|
70
|
+
*/
|
|
71
|
+
isEnabled(namespace: DebugNamespace): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Hands the session to every transport that can deliver it, then closes it.
|
|
74
|
+
*/
|
|
75
|
+
flush(target: IDebugDeliveryTarget): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Closes the session without delivering it.
|
|
78
|
+
*/
|
|
79
|
+
discard(): void;
|
|
80
|
+
}
|
|
81
|
+
export interface IDebuggerTransport {
|
|
82
|
+
canDeliver(target: IDebugDeliveryTarget): boolean;
|
|
83
|
+
deliver(params: IDebuggerTransportDeliverParams): Promise<void> | void;
|
|
84
|
+
}
|
|
85
|
+
/** Captures debug payloads for the current request, for delivery to a permitted identity. */
|
|
86
|
+
export declare const Debugger: import("@webiny/di").Abstraction<IDebugger>;
|
|
87
|
+
export declare namespace Debugger {
|
|
88
|
+
type Interface = IDebugger;
|
|
89
|
+
type Session = IDebugSession;
|
|
90
|
+
type Entry = IDebugEntry;
|
|
91
|
+
type StartParams = IDebuggerStartParams;
|
|
92
|
+
type PayloadFactory = IDebugPayloadFactory;
|
|
93
|
+
}
|
|
94
|
+
/** Delivers a finished debug session to a sink. */
|
|
95
|
+
export declare const DebuggerTransport: import("@webiny/di").Abstraction<IDebuggerTransport>;
|
|
96
|
+
export declare namespace DebuggerTransport {
|
|
97
|
+
type Interface = IDebuggerTransport;
|
|
98
|
+
type Target = IDebugDeliveryTarget;
|
|
99
|
+
type DeliverParams = IDebuggerTransportDeliverParams;
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/debugger/abstractions.js","sources":["../../../src/features/debugger/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Registry of debug namespace prefixes.\n *\n * Packages augment this interface to claim their own prefix:\n *\n * ```ts\n * declare module \"@webiny/api-core/features/debugger/abstractions.js\" {\n * interface DebugNamespaces {\n * cms: `cms.${string}`;\n * }\n * }\n * ```\n *\n * The module specifier must be exactly the one above - a relative path augments nothing.\n */\nexport interface DebugNamespaces {\n core: `core.${string}`;\n}\n\nexport type DebugNamespace = DebugNamespaces[keyof DebugNamespaces];\n\n/**\n * Produces the payload to capture. Invoked only when capture is active, so building an expensive\n * payload costs nothing when the debugger is off.\n */\nexport interface IDebugPayloadFactory {\n (): unknown;\n}\n\nexport interface IDebugEntry {\n seq: number;\n namespace: string;\n timestamp: number;\n /** Milliseconds since the session started. */\n elapsed: number;\n /** Already serialized and capped. Valid JSON. */\n json: string;\n bytes: number;\n}\n\nexport interface IDebugSession {\n namespaces: string[];\n startedAt: number;\n entries: IDebugEntry[];\n bytes: number;\n /** Entries discarded from the front of the buffer because the total budget was exceeded. */\n dropped: number;\n /** True once any single entry's payload was replaced by the per-entry cap marker. */\n truncated: boolean;\n}\n\nexport interface IDebuggerStartParams {\n namespaces: string[];\n}\n\nexport interface IDebugDeliveryTarget {\n type: string;\n}\n\nexport interface IDebuggerTransportDeliverParams {\n target: IDebugDeliveryTarget;\n session: IDebugSession;\n}\n\nexport interface IDebugger {\n /**\n * Opens a capture session, replacing any existing one.\n */\n start(params: IDebuggerStartParams): void;\n /**\n * Captures a payload, if a session is open and the namespace matches its filter.\n * Never throws.\n */\n log(namespace: DebugNamespace, payload: IDebugPayloadFactory): void;\n /**\n * Whether a namespace would currently be captured. For guarding expensive work *around* a log\n * call - `log` already performs this check itself.\n */\n isEnabled(namespace: DebugNamespace): boolean;\n /**\n * Hands the session to every transport that can deliver it, then closes it.\n */\n flush(target: IDebugDeliveryTarget): Promise<void>;\n /**\n * Closes the session without delivering it.\n */\n discard(): void;\n}\n\nexport interface IDebuggerTransport {\n canDeliver(target: IDebugDeliveryTarget): boolean;\n deliver(params: IDebuggerTransportDeliverParams): Promise<void> | void;\n}\n\n/** Captures debug payloads for the current request, for delivery to a permitted identity. */\nexport const Debugger = createAbstraction<IDebugger>(\"Debugger\");\n\nexport namespace Debugger {\n export type Interface = IDebugger;\n export type Session = IDebugSession;\n export type Entry = IDebugEntry;\n export type StartParams = IDebuggerStartParams;\n export type PayloadFactory = IDebugPayloadFactory;\n}\n\n/** Delivers a finished debug session to a sink. */\nexport const DebuggerTransport = createAbstraction<IDebuggerTransport>(\"DebuggerTransport\");\n\nexport namespace DebuggerTransport {\n export type Interface = IDebuggerTransport;\n export type Target = IDebugDeliveryTarget;\n export type DeliverParams = IDebuggerTransportDeliverParams;\n}\n"],"names":["Debugger","createAbstraction","DebuggerTransport"],"mappings":";AAiGO,MAAMA,WAAWC,kBAA6B;AAW9C,MAAMC,oBAAoBD,kBAAsC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { Debugger } from "./Debugger.js";
|
|
3
|
+
import { GraphQLDebuggerTransport } from "./GraphQLDebuggerTransport.js";
|
|
4
|
+
import { DebuggerRouteDecorator } from "./DebuggerRouteDecorator.js";
|
|
5
|
+
const DebuggerFeature = createFeature({
|
|
6
|
+
name: "DebuggerFeature",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(Debugger).inContainerScope();
|
|
9
|
+
container.register(GraphQLDebuggerTransport);
|
|
10
|
+
container.registerDecorator(DebuggerRouteDecorator);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { DebuggerFeature };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/debugger/feature.js","sources":["../../../src/features/debugger/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport { Debugger } from \"./Debugger.js\";\nimport { GraphQLDebuggerTransport } from \"./GraphQLDebuggerTransport.js\";\nimport { DebuggerRouteDecorator } from \"./DebuggerRouteDecorator.js\";\n\nexport const DebuggerFeature = createFeature({\n name: \"DebuggerFeature\",\n register(container: Container) {\n /*\n * The session is request state, so it is container scoped: one instance per request,\n * shared by the route decorator that opens and flushes it and by every call site in\n * between. A transient registration would hand each of them a different instance and\n * nothing would ever be captured; a singleton would carry one identity's entries into the\n * next request.\n */\n container.register(Debugger).inContainerScope();\n container.register(GraphQLDebuggerTransport);\n container.registerDecorator(DebuggerRouteDecorator);\n }\n});\n"],"names":["DebuggerFeature","createFeature","container","Debugger","GraphQLDebuggerTransport","DebuggerRouteDecorator"],"mappings":";;;;AAMO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAoB;QAQzBA,UAAU,QAAQ,CAACC,UAAU,gBAAgB;QAC7CD,UAAU,QAAQ,CAACE;QACnBF,UAAU,iBAAiB,CAACG;IAChC;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { Debugger } from "./abstractions.js";
|
|
2
|
+
export { DebuggerTransport } from "./abstractions.js";
|
|
3
|
+
export type { DebugNamespace } from "./abstractions.js";
|
|
4
|
+
export type { DebugNamespaces } from "./abstractions.js";
|
|
5
|
+
export { DebuggerFeature } from "./feature.js";
|
|
6
|
+
export { DEBUG_HEADER } from "./DebuggerRouteDecorator.js";
|
|
7
|
+
export { DEBUG_PERMISSION } from "./permissions.js";
|
|
8
|
+
export { GRAPHQL_TARGET } from "./GraphQLDebuggerTransport.js";
|
|
9
|
+
export type { IGraphQLDeliveryTarget } from "./GraphQLDebuggerTransport.js";
|
|
10
|
+
export { DEFAULT_LIMITS } from "./limits.js";
|
|
11
|
+
export type { IDebuggerLimits } from "./limits.js";
|
|
12
|
+
export { DEBUGGER_PERMISSIONS_SCHEMA } from "./permissionsSchema.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Debugger, DebuggerTransport } from "./abstractions.js";
|
|
2
|
+
export { DebuggerFeature } from "./feature.js";
|
|
3
|
+
export { DEBUG_HEADER } from "./DebuggerRouteDecorator.js";
|
|
4
|
+
export { DEBUG_PERMISSION } from "./permissions.js";
|
|
5
|
+
export { GRAPHQL_TARGET } from "./GraphQLDebuggerTransport.js";
|
|
6
|
+
export { DEFAULT_LIMITS } from "./limits.js";
|
|
7
|
+
export { DEBUGGER_PERMISSIONS_SCHEMA } from "./permissionsSchema.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture limits. None of these are settable by the client.
|
|
3
|
+
*/
|
|
4
|
+
export interface IDebuggerLimits {
|
|
5
|
+
/** Total serialized bytes a session may hold. Overflow drops entries from the front. */
|
|
6
|
+
totalBytes: number;
|
|
7
|
+
/** Maximum serialized size of a single entry, after the walk caps below are applied. */
|
|
8
|
+
entryBytes: number;
|
|
9
|
+
/** Runaway-loop guard. The byte budget is the real control. */
|
|
10
|
+
entryCount: number;
|
|
11
|
+
/** Maximum nesting depth walked before emitting a marker. */
|
|
12
|
+
depth: number;
|
|
13
|
+
/** Maximum characters kept from a single string value. */
|
|
14
|
+
stringLength: number;
|
|
15
|
+
/** Maximum items kept from a single array. */
|
|
16
|
+
arrayLength: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_LIMITS: IDebuggerLimits;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/debugger/limits.js","sources":["../../../src/features/debugger/limits.ts"],"sourcesContent":["/**\n * Capture limits. None of these are settable by the client.\n */\nexport interface IDebuggerLimits {\n /** Total serialized bytes a session may hold. Overflow drops entries from the front. */\n totalBytes: number;\n /** Maximum serialized size of a single entry, after the walk caps below are applied. */\n entryBytes: number;\n /** Runaway-loop guard. The byte budget is the real control. */\n entryCount: number;\n /** Maximum nesting depth walked before emitting a marker. */\n depth: number;\n /** Maximum characters kept from a single string value. */\n stringLength: number;\n /** Maximum items kept from a single array. */\n arrayLength: number;\n}\n\nexport const DEFAULT_LIMITS: IDebuggerLimits = {\n totalBytes: 4 * 1024 * 1024,\n entryBytes: 512 * 1024,\n entryCount: 10000,\n depth: 10,\n stringLength: 10000,\n arrayLength: 100\n};\n"],"names":["DEFAULT_LIMITS"],"mappings":"AAkBO,MAAMA,iBAAkC;IAC3C,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,cAAc;IACd,aAAa;AACjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface INamespaceFilter {
|
|
2
|
+
matches(namespace: string): boolean;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Builds a namespace matcher from the patterns requested by the client.
|
|
6
|
+
*
|
|
7
|
+
* A namespace matches when at least one positive pattern matches it and no negative pattern does.
|
|
8
|
+
*
|
|
9
|
+
* `minimatch` has its own native `!` negation which *inverts* the result rather than reporting a
|
|
10
|
+
* match, so `!cms.os.*` would return `true` for every namespace that does not match it. Patterns are
|
|
11
|
+
* therefore split into positive and negative lists here and matched positively, with `nonegate` set
|
|
12
|
+
* as a second guard.
|
|
13
|
+
*/
|
|
14
|
+
export declare const createNamespaceFilter: (patterns: string[]) => INamespaceFilter;
|