@webiny/api-core 6.4.12-beta.5 → 6.5.0-beta.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/ApiCoreFeature.js +0 -2
- package/ApiCoreFeature.js.map +1 -1
- package/createApiCore.d.ts +1 -1
- package/createApiCore.js +9 -7
- package/createApiCore.js.map +1 -1
- package/exports/api/security/api-key.d.ts +1 -0
- package/exports/api/security/api-key.js +1 -0
- package/exports/api.d.ts +2 -1
- package/exports/api.js +1 -1
- package/features/ai/Ai.d.ts +3 -1
- package/features/ai/Ai.js +38 -3
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AiModelRegistry.js +3 -1
- package/features/ai/AiModelRegistry.js.map +1 -1
- package/features/ai/AnthropicSdkFactory.js +24 -4
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/DEVELOPERS.md +126 -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 +67 -11
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
- package/features/ai/TextExtractor/abstractions.d.ts +12 -0
- package/features/ai/TextExtractor/abstractions.js +5 -0
- package/features/ai/TextExtractor/abstractions.js.map +1 -0
- package/features/ai/TextExtractor/index.d.ts +3 -0
- package/features/ai/TextExtractor/index.js +2 -0
- package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
- package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
- package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
- package/features/ai/abstractions.d.ts +4 -0
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/events.d.ts +59 -0
- package/features/ai/events.js +41 -0
- package/features/ai/events.js.map +1 -0
- package/features/ai/feature.js +9 -1
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +7 -1
- package/features/ai/index.js +3 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
- package/features/ai/toolPipeline/abstractions.d.ts +23 -0
- package/features/ai/toolPipeline/abstractions.js +7 -0
- package/features/ai/toolPipeline/abstractions.js.map +1 -0
- package/features/ai/toolPipeline/index.d.ts +2 -0
- package/features/ai/toolPipeline/index.js +1 -0
- package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
- package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
- package/features/security/apiKeys/feature.js +7 -2
- package/features/security/apiKeys/feature.js.map +1 -1
- package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
- package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
- package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
- package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
- package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
- package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
- package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
- package/features/security/apiKeys/shared/generateToken.js.map +1 -1
- package/features/security/apiKeys/shared/types.d.ts +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +1 -1
- package/features/security/utils/getPermissionsFromRoles.d.ts +1 -1
- package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
- package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
- package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
- package/features/serviceDiscovery/index.d.ts +3 -0
- package/features/serviceDiscovery/index.js +1 -0
- package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
- package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
- package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
- package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
- package/features/users/shared/loaders.js.map +1 -1
- package/features/wcp/WcpContext/WcpContext.d.ts +9 -0
- package/features/wcp/WcpContext/WcpContext.js +27 -0
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +31 -5
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +48 -2
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/legacy/security/plugins/apiKeyAuthentication.d.ts +1 -1
- package/legacy/security/plugins/apiKeyAuthorization.d.ts +1 -1
- package/legacy/security/plugins/authenticateUsingCookie.d.ts +1 -1
- package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +1 -1
- package/legacy/security/plugins/secureHeaders.js +0 -1
- package/legacy/security/plugins/secureHeaders.js.map +1 -1
- package/legacy/wcp/LegacyWcpContext.d.ts +9 -0
- package/legacy/wcp/LegacyWcpContext.js +27 -0
- package/legacy/wcp/LegacyWcpContext.js.map +1 -1
- package/package.json +24 -25
- package/types/security.d.ts +1 -1
- package/features/debugger/Debugger.d.ts +0 -23
- package/features/debugger/Debugger.js +0 -134
- package/features/debugger/Debugger.js.map +0 -1
- package/features/debugger/GraphQLDebuggerTransport.d.ts +0 -26
- package/features/debugger/GraphQLDebuggerTransport.js +0 -45
- package/features/debugger/GraphQLDebuggerTransport.js.map +0 -1
- package/features/debugger/__tests__/matchNamespace.test.js +0 -67
- package/features/debugger/__tests__/matchNamespace.test.js.map +0 -1
- package/features/debugger/__tests__/serialize.test.d.ts +0 -1
- package/features/debugger/__tests__/serialize.test.js +0 -220
- package/features/debugger/__tests__/serialize.test.js.map +0 -1
- package/features/debugger/abstractions.d.ts +0 -100
- package/features/debugger/abstractions.js +0 -6
- package/features/debugger/abstractions.js.map +0 -1
- package/features/debugger/feature.d.ts +0 -5
- package/features/debugger/feature.js +0 -15
- package/features/debugger/feature.js.map +0 -1
- package/features/debugger/index.d.ts +0 -7
- package/features/debugger/index.js +0 -7
- package/features/debugger/limits.d.ts +0 -18
- package/features/debugger/limits.js +0 -11
- package/features/debugger/limits.js.map +0 -1
- package/features/debugger/matchNamespace.d.ts +0 -21
- package/features/debugger/matchNamespace.js +0 -48
- package/features/debugger/matchNamespace.js.map +0 -1
- package/features/debugger/permissions.d.ts +0 -33
- package/features/debugger/permissions.js +0 -12
- package/features/debugger/permissions.js.map +0 -1
- package/features/debugger/permissionsSchema.d.ts +0 -17
- package/features/debugger/permissionsSchema.js +0 -18
- package/features/debugger/permissionsSchema.js.map +0 -1
- package/features/debugger/plugins.d.ts +0 -4
- package/features/debugger/plugins.js +0 -82
- package/features/debugger/plugins.js.map +0 -1
- package/features/debugger/serialize.d.ts +0 -11
- package/features/debugger/serialize.js +0 -121
- package/features/debugger/serialize.js.map +0 -1
- /package/features/{debugger/__tests__/matchNamespace.test.d.ts → serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts} +0 -0
|
@@ -57,9 +57,36 @@ class LegacyWcpContext {
|
|
|
57
57
|
canUseAiPageGeneration() {
|
|
58
58
|
return this.getWcpContext().canUseAiPageGeneration();
|
|
59
59
|
}
|
|
60
|
+
canUseAiPageTranslation() {
|
|
61
|
+
return this.getWcpContext().canUseAiPageTranslation();
|
|
62
|
+
}
|
|
60
63
|
canUseAiLexicalGeneration() {
|
|
61
64
|
return this.getWcpContext().canUseAiLexicalGeneration();
|
|
62
65
|
}
|
|
66
|
+
canUseAiEntryGeneration() {
|
|
67
|
+
return this.getWcpContext().canUseAiEntryGeneration();
|
|
68
|
+
}
|
|
69
|
+
canUseAiEntryComparison() {
|
|
70
|
+
return this.getWcpContext().canUseAiEntryComparison();
|
|
71
|
+
}
|
|
72
|
+
canUseAiEntryTranslation() {
|
|
73
|
+
return this.getWcpContext().canUseAiEntryTranslation();
|
|
74
|
+
}
|
|
75
|
+
canUseRemoteComponents() {
|
|
76
|
+
return this.getWcpContext().canUseRemoteComponents();
|
|
77
|
+
}
|
|
78
|
+
canUseAbTesting() {
|
|
79
|
+
return this.getWcpContext().canUseAbTesting();
|
|
80
|
+
}
|
|
81
|
+
canUseCollaboration() {
|
|
82
|
+
return this.getWcpContext().canUseCollaboration();
|
|
83
|
+
}
|
|
84
|
+
canUseComments() {
|
|
85
|
+
return this.getWcpContext().canUseComments();
|
|
86
|
+
}
|
|
87
|
+
canUseActivityLog() {
|
|
88
|
+
return this.getWcpContext().canUseActivityLog();
|
|
89
|
+
}
|
|
63
90
|
ensureCanUseFeature(featureId) {
|
|
64
91
|
this.getWcpContext().ensureCanUseFeature(featureId);
|
|
65
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/wcp/LegacyWcpContext.js","sources":["../../../src/legacy/wcp/LegacyWcpContext.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProject,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { WcpContextObject } from \"~/features/wcp/WcpContext/types.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nexport class LegacyWcpContext implements WcpContextObject {\n constructor(private container: Container) {}\n\n private getWcpContext(): WcpContext.Interface {\n return this.container.resolve(WcpContext);\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.getWcpContext().getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getWcpContext().getProjectWithFeatureFlags();\n }\n\n getProjectLicense(): ILicense {\n return this.getWcpContext().getProjectLicense();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return this.getWcpContext().getProjectEnvironment();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.getWcpContext().canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.getWcpContext().canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.getWcpContext().canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.getWcpContext().canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.getWcpContext().canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.getWcpContext().canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.getWcpContext().canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.getWcpContext().canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.getWcpContext().canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.getWcpContext().canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.getWcpContext().canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.getWcpContext().canUseAiPageGeneration();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.getWcpContext().canUseAiLexicalGeneration();\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void {\n this.getWcpContext().ensureCanUseFeature(featureId);\n }\n\n async incrementSeats(): Promise<void> {\n await this.getWcpContext().incrementSeats();\n }\n\n async decrementSeats(): Promise<void> {\n await this.getWcpContext().decrementSeats();\n }\n\n async incrementTenants(): Promise<void> {\n await this.getWcpContext().incrementTenants();\n }\n\n async decrementTenants(): Promise<void> {\n await this.getWcpContext().decrementTenants();\n }\n\n toDto(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().toDto();\n }\n}\n"],"names":["LegacyWcpContext","container","WcpContext","wcpFeatureId","featureId"],"mappings":";AAWO,MAAMA;IACT,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAEnC,gBAAsC;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;IAClC;IAEA,gBAAmD;QAC/C,OAAO,IAAI,CAAC,aAAa,GAAG,aAAa;IAC7C;IAEA,aAAgC;QAC5B,OAAO,IAAI,CAAC,aAAa,GAAG,UAAU;IAC1C;IAEA,6BAAgD;QAC5C,OAAO,IAAI,CAAC,aAAa,GAAG,0BAA0B;IAC1D;IAEA,oBAA8B;QAC1B,OAAO,IAAI,CAAC,aAAa,GAAG,iBAAiB;IACjD;IAEA,wBAAsD;QAClD,OAAO,IAAI,CAAC,aAAa,GAAG,qBAAqB;IACrD;IAEA,cAAcC,YAA4C,EAAW;QACjE,OAAO,IAAI,CAAC,aAAa,GAAG,aAAa,CAACA;IAC9C;IAEA,aAAsB;QAClB,OAAO,IAAI,CAAC,aAAa,GAAG,UAAU;IAC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pContext.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProject,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { WcpContextObject } from \"~/features/wcp/WcpContext/types.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nexport class LegacyWcpContext implements WcpContextObject {\n constructor(private container: Container) {}\n\n private getWcpContext(): WcpContext.Interface {\n return this.container.resolve(WcpContext);\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.getWcpContext().getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getWcpContext().getProjectWithFeatureFlags();\n }\n\n getProjectLicense(): ILicense {\n return this.getWcpContext().getProjectLicense();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return this.getWcpContext().getProjectEnvironment();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.getWcpContext().canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.getWcpContext().canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.getWcpContext().canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.getWcpContext().canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.getWcpContext().canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.getWcpContext().canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.getWcpContext().canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.getWcpContext().canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.getWcpContext().canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.getWcpContext().canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.getWcpContext().canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.getWcpContext().canUseAiPageGeneration();\n }\n\n canUseAiPageTranslation(): boolean {\n return this.getWcpContext().canUseAiPageTranslation();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.getWcpContext().canUseAiLexicalGeneration();\n }\n\n canUseAiEntryGeneration(): boolean {\n return this.getWcpContext().canUseAiEntryGeneration();\n }\n\n canUseAiEntryComparison(): boolean {\n return this.getWcpContext().canUseAiEntryComparison();\n }\n\n canUseAiEntryTranslation(): boolean {\n return this.getWcpContext().canUseAiEntryTranslation();\n }\n\n canUseRemoteComponents(): boolean {\n return this.getWcpContext().canUseRemoteComponents();\n }\n\n canUseAbTesting(): boolean {\n return this.getWcpContext().canUseAbTesting();\n }\n\n canUseCollaboration(): boolean {\n return this.getWcpContext().canUseCollaboration();\n }\n\n canUseComments(): boolean {\n return this.getWcpContext().canUseComments();\n }\n\n canUseActivityLog(): boolean {\n return this.getWcpContext().canUseActivityLog();\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void {\n this.getWcpContext().ensureCanUseFeature(featureId);\n }\n\n async incrementSeats(): Promise<void> {\n await this.getWcpContext().incrementSeats();\n }\n\n async decrementSeats(): Promise<void> {\n await this.getWcpContext().decrementSeats();\n }\n\n async incrementTenants(): Promise<void> {\n await this.getWcpContext().incrementTenants();\n }\n\n async decrementTenants(): Promise<void> {\n await this.getWcpContext().decrementTenants();\n }\n\n toDto(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().toDto();\n }\n}\n"],"names":["LegacyWcpContext","container","WcpContext","wcpFeatureId","featureId"],"mappings":";AAWO,MAAMA;IACT,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAEnC,gBAAsC;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;IAClC;IAEA,gBAAmD;QAC/C,OAAO,IAAI,CAA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QAC/B,OAAO,IAAI,CAAC,aAAa,GAAG,uBAAuB;IACvD;IAEA,0BAAmC;QAC/B,OAAO,IAAI,CAAC,aAAa,GAAG,uBAAuB;IACvD;IAEA,2BAAoC;QAChC,OAAO,IAAI,CAAC,aAAa,GAAG,wBAAwB;IACxD;IAEA,yBAAkC;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,sBAAsB;IACtD;IAEA,kBAA2B;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,eAAe;IAC/C;IAEA,sBAA+B;QAC3B,OAAO,IAAI,CAAC,aAAa,GAAG,mBAAmB;IACnD;IAEA,iBAA0B;QACtB,OAAO,IAAI,CAAC,aAAa,GAAG,cAAc;IAC9C;IAEA,oBAA6B;QACzB,OAAO,IAAI,CAAC,aAAa,GAAG,iBAAiB;IACjD;IAEA,oBAAoBC,SAAyC,EAAQ;QACjE,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAACA;IAC7C;IAEA,MAAM,iBAAgC;QAClC,MAAM,IAAI,CAAC,aAAa,GAAG,cAAc;IAC7C;IAEA,MAAM,iBAAgC;QAClC,MAAM,IAAI,CAAC,aAAa,GAAG,cAAc;IAC7C;IAEA,MAAM,mBAAkC;QACpC,MAAM,IAAI,CAAC,aAAa,GAAG,gBAAgB;IAC/C;IAEA,MAAM,mBAAkC;QACpC,MAAM,IAAI,CAAC,aAAa,GAAG,gBAAgB;IAC/C;IAEA,QAA2C;QACvC,OAAO,IAAI,CAAC,aAAa,GAAG,KAAK;IACrC;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,39 +14,38 @@
|
|
|
14
14
|
"./*": "./*"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ai-sdk/anthropic": "4.0.
|
|
18
|
-
"@ai-sdk/
|
|
19
|
-
"@
|
|
20
|
-
"@webiny/
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/feature
|
|
24
|
-
"@webiny/
|
|
25
|
-
"@webiny/handler
|
|
26
|
-
"@webiny/handler-
|
|
27
|
-
"@webiny/
|
|
28
|
-
"@webiny/
|
|
29
|
-
"@webiny/
|
|
30
|
-
"
|
|
17
|
+
"@ai-sdk/anthropic": "4.0.49",
|
|
18
|
+
"@ai-sdk/google": "4.0.64",
|
|
19
|
+
"@ai-sdk/openai": "4.0.60",
|
|
20
|
+
"@webiny/api": "6.5.0-beta.1",
|
|
21
|
+
"@webiny/di": "1.0.2",
|
|
22
|
+
"@webiny/error": "6.5.0-beta.1",
|
|
23
|
+
"@webiny/feature": "6.5.0-beta.1",
|
|
24
|
+
"@webiny/feature-flags": "6.5.0-beta.1",
|
|
25
|
+
"@webiny/handler": "6.5.0-beta.1",
|
|
26
|
+
"@webiny/handler-db": "6.5.0-beta.1",
|
|
27
|
+
"@webiny/handler-graphql": "6.5.0-beta.1",
|
|
28
|
+
"@webiny/plugins": "6.5.0-beta.1",
|
|
29
|
+
"@webiny/utils": "6.5.0-beta.1",
|
|
30
|
+
"@webiny/wcp": "6.5.0-beta.1",
|
|
31
|
+
"ai": "7.0.34",
|
|
31
32
|
"dataloader": "2.2.3",
|
|
32
|
-
"jose": "6.2.
|
|
33
|
+
"jose": "6.2.3",
|
|
33
34
|
"jsonwebtoken": "9.0.3",
|
|
34
35
|
"lodash": "4.18.1",
|
|
35
|
-
"minimatch": "10.2.
|
|
36
|
+
"minimatch": "10.2.5",
|
|
36
37
|
"pino": "10.3.1",
|
|
37
38
|
"pino-lambda": "4.4.1",
|
|
38
|
-
"zod": "4.
|
|
39
|
+
"zod": "4.4.3"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@types/jsonwebtoken": "9.0.10",
|
|
42
|
-
"@webiny/build-tools": "6.
|
|
43
|
-
"@webiny/
|
|
44
|
-
"@webiny/
|
|
45
|
-
"@webiny/project-utils": "6.4.12-beta.5",
|
|
46
|
-
"jest-dynalite": "3.6.1",
|
|
43
|
+
"@webiny/build-tools": "6.5.0-beta.1",
|
|
44
|
+
"@webiny/handler-aws": "6.5.0-beta.1",
|
|
45
|
+
"@webiny/project-utils": "6.5.0-beta.1",
|
|
47
46
|
"rimraf": "6.1.3",
|
|
48
|
-
"typescript": "
|
|
49
|
-
"vitest": "
|
|
47
|
+
"typescript": "7.0.2",
|
|
48
|
+
"vitest": "4.1.10"
|
|
50
49
|
},
|
|
51
50
|
"publishConfig": {
|
|
52
51
|
"access": "public"
|
package/types/security.d.ts
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Debugger as DebuggerAbstraction, DebuggerTransport, type DebugNamespace, type IDebugDeliveryTarget, type IDebuggerStartParams, type IDebugPayloadFactory } from "./abstractions.js";
|
|
2
|
-
import { IdentityContext } from "../../features/security/IdentityContext/index.js";
|
|
3
|
-
import { BuildParams } from "../../features/buildParams/index.js";
|
|
4
|
-
export declare class DebuggerImpl implements DebuggerAbstraction.Interface {
|
|
5
|
-
private readonly identityContext;
|
|
6
|
-
private readonly buildParams;
|
|
7
|
-
private readonly transports;
|
|
8
|
-
private session;
|
|
9
|
-
private readonly limits;
|
|
10
|
-
constructor(identityContext: IdentityContext.Interface, buildParams: BuildParams.Interface, transports: DebuggerTransport.Interface[]);
|
|
11
|
-
start(params: IDebuggerStartParams): void;
|
|
12
|
-
isEnabled(namespace: DebugNamespace): boolean;
|
|
13
|
-
log(namespace: DebugNamespace, payload: IDebugPayloadFactory): void;
|
|
14
|
-
flush(target: IDebugDeliveryTarget): Promise<void>;
|
|
15
|
-
discard(): void;
|
|
16
|
-
private isDisabled;
|
|
17
|
-
/**
|
|
18
|
-
* Drops entries from the front until the session fits the byte budget. The client reproduces the
|
|
19
|
-
* bug, so the failure is at the end of the session and the tail is what matters.
|
|
20
|
-
*/
|
|
21
|
-
private enforceBudget;
|
|
22
|
-
}
|
|
23
|
-
export declare const Debugger: import("@webiny/di").Implementation<typeof DebuggerImpl>;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/feature/api";
|
|
2
|
-
import { Debugger, DebuggerTransport } from "./abstractions.js";
|
|
3
|
-
import { IdentityContext } from "../security/IdentityContext/index.js";
|
|
4
|
-
import { BuildParams } from "../buildParams/index.js";
|
|
5
|
-
import { createNamespaceFilter } from "./matchNamespace.js";
|
|
6
|
-
import { DEFAULT_LIMITS } from "./limits.js";
|
|
7
|
-
import { serialize } from "./serialize.js";
|
|
8
|
-
const FLUSH_TIMEOUT_MS = 2000;
|
|
9
|
-
const describeError = (error)=>{
|
|
10
|
-
if (error instanceof Error) return `${error.name}: ${error.message}`;
|
|
11
|
-
return "Unknown error.";
|
|
12
|
-
};
|
|
13
|
-
class DebuggerImpl {
|
|
14
|
-
constructor(identityContext, buildParams, transports){
|
|
15
|
-
this.identityContext = identityContext;
|
|
16
|
-
this.buildParams = buildParams;
|
|
17
|
-
this.transports = transports;
|
|
18
|
-
this.session = void 0;
|
|
19
|
-
this.limits = DEFAULT_LIMITS;
|
|
20
|
-
}
|
|
21
|
-
start(params) {
|
|
22
|
-
if (this.isDisabled()) return;
|
|
23
|
-
if (0 === params.namespaces.length) return;
|
|
24
|
-
this.session = {
|
|
25
|
-
namespaces: params.namespaces,
|
|
26
|
-
filter: createNamespaceFilter(params.namespaces),
|
|
27
|
-
startedAt: Date.now(),
|
|
28
|
-
entries: [],
|
|
29
|
-
bytes: 0,
|
|
30
|
-
dropped: 0,
|
|
31
|
-
truncated: false,
|
|
32
|
-
seq: 0
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
isEnabled(namespace) {
|
|
36
|
-
const session = this.session;
|
|
37
|
-
if (!session) return false;
|
|
38
|
-
if (this.identityContext.getIdentity().isAnonymous()) return false;
|
|
39
|
-
return session.filter.matches(namespace);
|
|
40
|
-
}
|
|
41
|
-
log(namespace, payload) {
|
|
42
|
-
try {
|
|
43
|
-
const session = this.session;
|
|
44
|
-
if (!session || !this.isEnabled(namespace)) return;
|
|
45
|
-
if (session.entries.length >= this.limits.entryCount) return;
|
|
46
|
-
const { json, bytes, truncated } = serialize(payload(), this.limits);
|
|
47
|
-
const entry = {
|
|
48
|
-
seq: ++session.seq,
|
|
49
|
-
namespace,
|
|
50
|
-
timestamp: Date.now(),
|
|
51
|
-
elapsed: Date.now() - session.startedAt,
|
|
52
|
-
json,
|
|
53
|
-
bytes
|
|
54
|
-
};
|
|
55
|
-
session.entries.push(entry);
|
|
56
|
-
session.bytes += bytes;
|
|
57
|
-
session.truncated = session.truncated || truncated;
|
|
58
|
-
this.enforceBudget(session);
|
|
59
|
-
} catch (ex) {
|
|
60
|
-
console.error(`Debugger failed to capture "${namespace}".`, describeError(ex));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
async flush(target) {
|
|
64
|
-
const session = this.session;
|
|
65
|
-
this.session = void 0;
|
|
66
|
-
if (!session) return;
|
|
67
|
-
const transports = this.transports.filter((transport)=>{
|
|
68
|
-
try {
|
|
69
|
-
return transport.canDeliver(target);
|
|
70
|
-
} catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (0 === transports.length) return;
|
|
75
|
-
const frozen = Object.freeze({
|
|
76
|
-
namespaces: session.namespaces,
|
|
77
|
-
startedAt: session.startedAt,
|
|
78
|
-
entries: session.entries,
|
|
79
|
-
bytes: session.bytes,
|
|
80
|
-
dropped: session.dropped,
|
|
81
|
-
truncated: session.truncated
|
|
82
|
-
});
|
|
83
|
-
const delivery = Promise.allSettled(transports.map(async (transport)=>await transport.deliver({
|
|
84
|
-
target,
|
|
85
|
-
session: frozen
|
|
86
|
-
})));
|
|
87
|
-
let timer;
|
|
88
|
-
const timeout = new Promise((resolve)=>{
|
|
89
|
-
timer = setTimeout(resolve, FLUSH_TIMEOUT_MS);
|
|
90
|
-
});
|
|
91
|
-
try {
|
|
92
|
-
const results = await Promise.race([
|
|
93
|
-
delivery,
|
|
94
|
-
timeout
|
|
95
|
-
]);
|
|
96
|
-
if (Array.isArray(results)) {
|
|
97
|
-
for (const result of results)if ("rejected" === result.status) console.error("Debugger transport failed to deliver.", describeError(result.reason));
|
|
98
|
-
}
|
|
99
|
-
} finally{
|
|
100
|
-
if (timer) clearTimeout(timer);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
discard() {
|
|
104
|
-
this.session = void 0;
|
|
105
|
-
}
|
|
106
|
-
isDisabled() {
|
|
107
|
-
return true === this.buildParams.get("DebuggerDisabled");
|
|
108
|
-
}
|
|
109
|
-
enforceBudget(session) {
|
|
110
|
-
while(session.bytes > this.limits.totalBytes && session.entries.length > 0){
|
|
111
|
-
const removed = session.entries.shift();
|
|
112
|
-
if (!removed) break;
|
|
113
|
-
session.bytes -= removed.bytes;
|
|
114
|
-
session.dropped++;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const Debugger_Debugger = createImplementation({
|
|
119
|
-
abstraction: Debugger,
|
|
120
|
-
implementation: DebuggerImpl,
|
|
121
|
-
dependencies: [
|
|
122
|
-
IdentityContext,
|
|
123
|
-
BuildParams,
|
|
124
|
-
[
|
|
125
|
-
DebuggerTransport,
|
|
126
|
-
{
|
|
127
|
-
multiple: true
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
]
|
|
131
|
-
});
|
|
132
|
-
export { DebuggerImpl, Debugger_Debugger as Debugger };
|
|
133
|
-
|
|
134
|
-
//# sourceMappingURL=Debugger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/debugger/Debugger.js","sources":["../../../src/features/debugger/Debugger.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport {\n Debugger as DebuggerAbstraction,\n DebuggerTransport,\n type DebugNamespace,\n type IDebugDeliveryTarget,\n type IDebugEntry,\n type IDebuggerStartParams,\n type IDebugPayloadFactory,\n type IDebugSession\n} from \"./abstractions.js\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { BuildParams } from \"~/features/buildParams/index.js\";\nimport { createNamespaceFilter, type INamespaceFilter } from \"./matchNamespace.js\";\nimport { DEFAULT_LIMITS, type IDebuggerLimits } from \"./limits.js\";\nimport { serialize } from \"./serialize.js\";\n\nconst FLUSH_TIMEOUT_MS = 2000;\n\n/**\n * Renders an error for logging without touching anything that could hold a captured payload.\n *\n * Deliberately not `stringifyError` from `@webiny/handler`: that spreads the whole error object, so\n * an error carrying a `data` property would put debug payloads into CloudWatch - the one sink they\n * must never reach.\n */\nconst describeError = (error: unknown): string => {\n if (error instanceof Error) {\n return `${error.name}: ${error.message}`;\n }\n return \"Unknown error.\";\n};\n\ninterface IActiveSession extends IDebugSession {\n filter: INamespaceFilter;\n seq: number;\n}\n\nexport class DebuggerImpl implements DebuggerAbstraction.Interface {\n private session: IActiveSession | undefined = undefined;\n private readonly limits: IDebuggerLimits = DEFAULT_LIMITS;\n\n public constructor(\n private readonly identityContext: IdentityContext.Interface,\n private readonly buildParams: BuildParams.Interface,\n private readonly transports: DebuggerTransport.Interface[]\n ) {}\n\n public start(params: IDebuggerStartParams): void {\n if (this.isDisabled()) {\n return;\n }\n\n if (params.namespaces.length === 0) {\n return;\n }\n\n /**\n * Always replace. A session surviving into the next request would mean one identity\n * receiving another's entries.\n */\n this.session = {\n namespaces: params.namespaces,\n filter: createNamespaceFilter(params.namespaces),\n startedAt: Date.now(),\n entries: [],\n bytes: 0,\n dropped: 0,\n truncated: false,\n seq: 0\n };\n }\n\n public isEnabled(namespace: DebugNamespace): boolean {\n const session = this.session;\n if (!session) {\n return false;\n }\n\n /**\n * An anonymous identity must never accumulate payloads. The flush-time permission check is\n * authoritative, but this earlier gate means there is nothing to leak if a future code path\n * delivers a session without passing through it.\n */\n if (this.identityContext.getIdentity().isAnonymous()) {\n return false;\n }\n\n return session.filter.matches(namespace);\n }\n\n public log(namespace: DebugNamespace, payload: IDebugPayloadFactory): void {\n /**\n * The debugger must never be able to break the request it is observing, and payload\n * factories are written in a hurry during an incident.\n */\n try {\n const session = this.session;\n if (!session || !this.isEnabled(namespace)) {\n return;\n }\n\n if (session.entries.length >= this.limits.entryCount) {\n return;\n }\n\n /**\n * Invoke and serialize immediately: this releases the closure and the payload graph, and\n * it is what makes the entry's size known, which is what makes the budget enforceable.\n */\n const { json, bytes, truncated } = serialize(payload(), this.limits);\n\n const entry: IDebugEntry = {\n seq: ++session.seq,\n namespace,\n timestamp: Date.now(),\n elapsed: Date.now() - session.startedAt,\n json,\n bytes\n };\n\n session.entries.push(entry);\n session.bytes += bytes;\n session.truncated = session.truncated || truncated;\n\n this.enforceBudget(session);\n } catch (ex) {\n console.error(`Debugger failed to capture \"${namespace}\".`, describeError(ex));\n }\n }\n\n public async flush(target: IDebugDeliveryTarget): Promise<void> {\n const session = this.session;\n this.session = undefined;\n\n if (!session) {\n return;\n }\n\n const transports = this.transports.filter(transport => {\n try {\n return transport.canDeliver(target);\n } catch {\n return false;\n }\n });\n\n if (transports.length === 0) {\n return;\n }\n\n const frozen = Object.freeze({\n namespaces: session.namespaces,\n startedAt: session.startedAt,\n entries: session.entries,\n bytes: session.bytes,\n dropped: session.dropped,\n truncated: session.truncated\n }) as IDebugSession;\n\n const delivery = Promise.allSettled(\n transports.map(async transport => {\n return await transport.deliver({ target, session: frozen });\n })\n );\n\n /**\n * In-memory delivery is instant, but a future network sink is not, and debug data is never\n * worth making the app feel broken. The timer is cleared so it cannot hold the event loop\n * open between the response and the Lambda freeze.\n */\n let timer: NodeJS.Timeout | undefined;\n const timeout = new Promise<void>(resolve => {\n timer = setTimeout(resolve, FLUSH_TIMEOUT_MS);\n });\n\n try {\n const results = await Promise.race([delivery, timeout]);\n if (Array.isArray(results)) {\n for (const result of results) {\n if (result.status === \"rejected\") {\n /**\n * Only the error - never the session or any entry. `console.error` goes to\n * CloudWatch, which is the one place debug payloads must never reach.\n */\n console.error(\n \"Debugger transport failed to deliver.\",\n describeError(result.reason)\n );\n }\n }\n }\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n }\n\n public discard(): void {\n this.session = undefined;\n }\n\n private isDisabled(): boolean {\n return this.buildParams.get<boolean>(\"DebuggerDisabled\") === true;\n }\n\n /**\n * Drops entries from the front until the session fits the byte budget. The client reproduces the\n * bug, so the failure is at the end of the session and the tail is what matters.\n */\n private enforceBudget(session: IActiveSession): void {\n while (session.bytes > this.limits.totalBytes && session.entries.length > 0) {\n const removed = session.entries.shift();\n if (!removed) {\n break;\n }\n session.bytes -= removed.bytes;\n session.dropped++;\n }\n }\n}\n\nexport const Debugger = createImplementation({\n abstraction: DebuggerAbstraction,\n implementation: DebuggerImpl,\n dependencies: [IdentityContext, BuildParams, [DebuggerTransport, { multiple: true }]]\n});\n"],"names":["FLUSH_TIMEOUT_MS","describeError","error","Error","DebuggerImpl","identityContext","buildParams","transports","undefined","DEFAULT_LIMITS","params","createNamespaceFilter","Date","namespace","session","payload","json","bytes","truncated","serialize","entry","ex","console","target","transport","frozen","Object","delivery","Promise","timer","timeout","resolve","setTimeout","results","Array","result","clearTimeout","removed","Debugger","createImplementation","DebuggerAbstraction","IdentityContext","BuildParams","DebuggerTransport"],"mappings":";;;;;;;AAiBA,MAAMA,mBAAmB;AASzB,MAAMC,gBAAgB,CAACC;IACnB,IAAIA,iBAAiBC,OACjB,OAAO,GAAGD,MAAM,IAAI,CAAC,EAAE,EAAEA,MAAM,OAAO,EAAE;IAE5C,OAAO;AACX;AAOO,MAAME;IAIT,YACqBC,eAA0C,EAC1CC,WAAkC,EAClCC,UAAyC,CAC5D;aAHmBF,eAAe,GAAfA;aACAC,WAAW,GAAXA;aACAC,UAAU,GAAVA;aANb,OAAO,GAA+BC;aAC7B,MAAM,GAAoBC;IAMxC;IAEI,MAAMC,MAA4B,EAAQ;QAC7C,IAAI,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AAK,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAIA,QAAQ,OAAO,CAAC,MAAM,GAAG,EAAG;YACzE,MAAMuB,UAAUvB,QAAQ,OAAO,CAAC,KAAK;YACrC,IAAI,CAACuB,SACD;YAEJvB,QAAQ,KAAK,IAAIuB,QAAQ,KAAK;YAC9BvB,QAAQ,OAAO;QACnB;IACJ;AACJ;AAEO,MAAMwB,oBAAWC,qBAAqB;IACzC,aAAaC;IACb,gBAAgBpC;IAChB,cAAc;QAACqC;QAAiBC;QAAa;YAACC;YAAmB;gBAAE,UAAU;YAAK;SAAE;KAAC;AACzF"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DebuggerTransport as DebuggerTransportAbstraction, type IDebugDeliveryTarget, type IDebuggerTransportDeliverParams } from "./abstractions.js";
|
|
2
|
-
export declare const GRAPHQL_TARGET = "graphql";
|
|
3
|
-
export interface IGraphQLDeliveryTarget extends IDebugDeliveryTarget {
|
|
4
|
-
type: typeof GRAPHQL_TARGET;
|
|
5
|
-
/**
|
|
6
|
-
* Already resolved to a single result object - never the array. Batched requests are reduced to
|
|
7
|
-
* their last element by the flush plugin, so this transport never has to know about batching.
|
|
8
|
-
*/
|
|
9
|
-
result: Record<string, any>;
|
|
10
|
-
requestId: string;
|
|
11
|
-
operations: string[];
|
|
12
|
-
url: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Writes a finished session into the GraphQL response's `extensions` property.
|
|
16
|
-
*/
|
|
17
|
-
export declare class GraphQLDebuggerTransportImpl implements DebuggerTransportAbstraction.Interface {
|
|
18
|
-
canDeliver(target: IDebugDeliveryTarget): boolean;
|
|
19
|
-
deliver({ target, session }: IDebuggerTransportDeliverParams): void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Merges a value under `extensions.debug`, never assigning `extensions` wholesale - other plugins
|
|
23
|
-
* write to it too.
|
|
24
|
-
*/
|
|
25
|
-
export declare const writeExtension: (result: Record<string, any>, debug: Record<string, any>) => void;
|
|
26
|
-
export declare const GraphQLDebuggerTransport: import("@webiny/di").Implementation<typeof GraphQLDebuggerTransportImpl>;
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/debugger/GraphQLDebuggerTransport.js","sources":["../../../src/features/debugger/GraphQLDebuggerTransport.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport {\n DebuggerTransport as DebuggerTransportAbstraction,\n type IDebugDeliveryTarget,\n type IDebuggerTransportDeliverParams\n} 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 flush plugin, 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":";;AAOO,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"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { createNamespaceFilter, parseNamespaceHeader } from "../matchNamespace.js";
|
|
3
|
-
describe("parseNamespaceHeader", ()=>{
|
|
4
|
-
it("should not start a session when the header is absent or empty", ()=>{
|
|
5
|
-
expect(parseNamespaceHeader(void 0)).toEqual([]);
|
|
6
|
-
expect(parseNamespaceHeader("")).toEqual([]);
|
|
7
|
-
expect(parseNamespaceHeader(" ")).toEqual([]);
|
|
8
|
-
});
|
|
9
|
-
it("should treat the truthy shorthands as capture-all", ()=>{
|
|
10
|
-
expect(parseNamespaceHeader("1")).toEqual([
|
|
11
|
-
"*"
|
|
12
|
-
]);
|
|
13
|
-
expect(parseNamespaceHeader("true")).toEqual([
|
|
14
|
-
"*"
|
|
15
|
-
]);
|
|
16
|
-
expect(parseNamespaceHeader("*")).toEqual([
|
|
17
|
-
"*"
|
|
18
|
-
]);
|
|
19
|
-
});
|
|
20
|
-
it("should trim tokens, since duplicate headers arrive comma-joined with spaces", ()=>{
|
|
21
|
-
expect(parseNamespaceHeader("cms.os.*, fm.*")).toEqual([
|
|
22
|
-
"cms.os.*",
|
|
23
|
-
"fm.*"
|
|
24
|
-
]);
|
|
25
|
-
});
|
|
26
|
-
it("should accept the array form produced by app.inject", ()=>{
|
|
27
|
-
expect(parseNamespaceHeader([
|
|
28
|
-
"cms.os.*",
|
|
29
|
-
"fm.*"
|
|
30
|
-
])).toEqual([
|
|
31
|
-
"cms.os.*",
|
|
32
|
-
"fm.*"
|
|
33
|
-
]);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
describe("createNamespaceFilter", ()=>{
|
|
37
|
-
it("should match everything for the wildcard", ()=>{
|
|
38
|
-
const filter = createNamespaceFilter([
|
|
39
|
-
"*"
|
|
40
|
-
]);
|
|
41
|
-
expect(filter.matches("cms.os.list")).toBe(true);
|
|
42
|
-
expect(filter.matches("core.anything")).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
it("should match a prefix glob across dots", ()=>{
|
|
45
|
-
const filter = createNamespaceFilter([
|
|
46
|
-
"cms.*"
|
|
47
|
-
]);
|
|
48
|
-
expect(filter.matches("cms.os.list")).toBe(true);
|
|
49
|
-
expect(filter.matches("fm.file.get")).toBe(false);
|
|
50
|
-
});
|
|
51
|
-
it("should exclude rather than invert on negation", ()=>{
|
|
52
|
-
const filter = createNamespaceFilter([
|
|
53
|
-
"*",
|
|
54
|
-
"!cms.os.*"
|
|
55
|
-
]);
|
|
56
|
-
expect(filter.matches("cms.os.list")).toBe(false);
|
|
57
|
-
expect(filter.matches("fm.file.get")).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
it("should require at least one positive match", ()=>{
|
|
60
|
-
const filter = createNamespaceFilter([
|
|
61
|
-
"!cms.os.*"
|
|
62
|
-
]);
|
|
63
|
-
expect(filter.matches("fm.file.get")).toBe(false);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=matchNamespace.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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, parseNamespaceHeader } from \"../matchNamespace.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 produced by app.inject\", () => {\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":";;AAGAA,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,OAA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