我正在查看Microsoft 的 React-Native 移动中心 SDK 的源代码。React-Native 有几个原生模块,推荐的安装方式是通过 Cocoapods。
现在,每个模块都有 podspec,但没有提及React依赖项。例如,appcenter-crashes.podspec具有以下依赖关系:
s.dependency 'AppCenterReactNativeShared'
s.dependency 'AppCenter/Crashes'
Run Code Online (Sandbox Code Playgroud)
并且AppCenterReactNativeShared.podspec刚刚
s.dependency 'AppCenter/Core', '1.1.0'
Run Code Online (Sandbox Code Playgroud)
然而,该模块是反应本机桥梁,依赖于其源React并从中导入React。例如,AppCenterReactNativeCrashes.m有这些行:
#import "AppCenterReactNativeCrashes.h"
// Support React Native headers both in the React namespace, where they are in RN version 0.40+,
// and no namespace, for older versions of React Native
#if __has_include(<React/RCTAssert.h>)
#import <React/RCTAssert.h>
#import <React/RCTBridgeModule.h>
...
Run Code Online (Sandbox Code Playgroud)
接下来,在我的 React-Native 项目中,我可以链接移动中心并使用 Podfile 构建和运行我的应用程序,如下所示:
target 'example' do
pod 'AppCenter/Crashes', '~> …Run Code Online (Sandbox Code Playgroud) 我有一个由 apollo-server 提供支持的 node.js 项目。我使用自定义@admin指令对查询、突变和对象字段进行权限检查。对于查询和变异,此指令会引发错误,对于字段,它返回 null 而不是实际值。
现在,我想将 graphiql ui 添加到我的项目中,以便其他开发人员可以探索我的 graphql 模式。但是,我希望他们以匿名用户的方式查看模式,即他们不应该知道@admin字段和@admin查询的存在以及所有更改(即使是非管理员更改)。即使那些拥有执行这些操作的凭据(即以管理员身份登录)的人也不应该看到架构的这些部分。
据我了解,graphiql发送特殊内省查询,其中包含__schema和__type区域显示模式和它的文档。
是否有可能以某种方式修改我的架构,该架构是使用makeExecutableSchemafrom构建的graphql-tools以实现我的目标?