graphql-type-json#GraphQLJSONObject TypeScript Examples

The following examples show how to use graphql-type-json#GraphQLJSONObject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: whisp.resolver.ts    From whispr with MIT License 6 votes vote down vote up
/**
   * Subscriptions
   */

  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  @Subscription(() => Whisp, {
    filter: (payload, variables) => filterPayload(variables.filter, payload.whispAdded),
  })
  whispAdded(
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    @Args('filter', { type: () => GraphQLJSONObject }) filter: Record<string, unknown>,
  ): AsyncIterator<IWhisp> {
    return this.pubSub.asyncIterator('whispAdded');
  }
Example #2
Source File: buildPoliciesType.ts    From payload with MIT License 6 votes vote down vote up
buildEntity = (label: string, entityFields: Field[], operations: OperationType[]) => {
  const formattedLabel = formatName(label);

  const fields = {
    fields: {
      type: new GraphQLObjectType({
        name: formatName(`${formattedLabel}Fields`),
        fields: buildFields(`${formattedLabel}Fields`, entityFields),
      }),
    },
  };

  operations.forEach((operation) => {
    const capitalizedOperation = operation.charAt(0).toUpperCase() + operation.slice(1);

    fields[operation] = {
      type: new GraphQLObjectType({
        name: `${formattedLabel}${capitalizedOperation}Access`,
        fields: {
          permission: { type: new GraphQLNonNull(GraphQLBoolean) },
          where: { type: GraphQLJSONObject },
        },
      }),
    };
  });

  return fields;
}
Example #3
Source File: JsonNullableFilter.ts    From amplication with Apache License 2.0 6 votes vote down vote up
@ApiProperty({
    required: false,
    type: GraphQLJSONObject,
  })
  @IsOptional()
  @Field(() => GraphQLJSONObject, {
    nullable: true,
  })
  not?: JsonValue;
Example #4
Source File: JsonNullableFilter.ts    From amplication with Apache License 2.0 6 votes vote down vote up
@ApiProperty({
    required: false,
    type: GraphQLJSONObject,
  })
  @IsOptional()
  @Field(() => GraphQLJSONObject, {
    nullable: true,
  })
  equals?: JsonValue;
Example #5
Source File: JsonFilter.ts    From amplication with Apache License 2.0 6 votes vote down vote up
@ApiProperty({
    required: false,
    type: GraphQLJSONObject,
  })
  @IsOptional()
  @Field(() => GraphQLJSONObject, {
    nullable: true,
  })
  not?: InputJsonValue;
Example #6
Source File: JsonFilter.ts    From amplication with Apache License 2.0 6 votes vote down vote up
@ApiProperty({
    required: false,
    type: GraphQLJSONObject,
  })
  @IsOptional()
  @Field(() => GraphQLJSONObject, {
    nullable: true,
  })
  equals?: InputJsonValue;
Example #7
Source File: whisp.resolver.ts    From whispr with MIT License 6 votes vote down vote up
@Query(() => [WhispCount])
  async countWhisps(
    @Args('filter', { type: () => [GraphQLJSONObject], nullable: true })
      filter: Record<string, unknown>[],
    @Args('group', { type: () => GraphQLJSONObject, nullable: true })
      group: Record<string, unknown>,
  ): Promise<WhispCount[]> {
    return this.whispService.countWhispsGroup(filter, group);
  }
Example #8
Source File: whisp.resolver.ts    From whispr with MIT License 6 votes vote down vote up
@UseGuards(GqlJwtAuthGuard)
  @Query(() => [Whisp], { nullable: true })
  async whispsAuthBeta(
    @Args('filter', { type: () => GraphQLJSONObject, nullable: true })
      filter?: Record<string, unknown>,
    @Args('sort', { type: () => GraphQLJSONObject, nullable: true })
      sort?: Record<string, unknown>,
    @Args('limit', { type: () => Int, nullable: true }) limit?: number,
  ): Promise<IWhisp[]> {
    return this.whispService.findAll(filter, sort, limit);
  }
Example #9
Source File: whisp.resolver.ts    From whispr with MIT License 6 votes vote down vote up
@Query(() => [Whisp], { nullable: true })
  async whisps(
    @Args('filter', { type: () => GraphQLJSONObject, nullable: true })
      filter?: Record<string, unknown>,
    @Args('sort', { type: () => GraphQLJSONObject, nullable: true })
      sort?: Record<string, unknown>,
    @Args('limit', { type: () => Int, nullable: true }) limit?: number,
  ): Promise<IWhisp[]> {
    return this.whispService.findAll(filter, sort, limit);
  }
Example #10
Source File: index.ts    From Nishan with MIT License 6 votes vote down vote up
NotionGraphqlResolvers = {
	JSONObject: GraphQLJSONObject,
	Query: NotionGraphqlQueryResolvers,
	Page: NotionGraphqlPageResolver,
	Collection: NotionGraphqlCollectionResolver,
	CollectionView: NotionGraphqlCollectionBlockResolver,
	CollectionViewPage: NotionGraphqlCollectionBlockResolver,
	Space: NotionGraphqlSpaceResolver,
	TPage: {
		__resolveType: getBlockResolveType
	},
	TParent: {
		__resolveType: getParentResolveType
	},
	TCollectionBlock: {
		__resolveType: getBlockResolveType
	},
	TBlock: {
		__resolveType: getBlockResolveType
	},
	Block: {
		__resolveType: getBlockResolveType
	}
}
Example #11
Source File: attribute.resolver.ts    From Cromwell with MIT License 5 votes vote down vote up
@FieldResolver(() => GraphQLJSONObject, { nullable: true })
    async customMeta(@Root() entity: Attribute, @Arg("keys", () => [String]) fields: string[]): Promise<any> {
        return entityMetaRepository.getEntityMetaByKeys(EDBEntity.Attribute, entity.id, fields);
    }
Example #12
Source File: product-variant.input.ts    From Cromwell with MIT License 5 votes vote down vote up
@Field(() => GraphQLJSONObject, { nullable: true })
    attributes: Record<string, string | number | 'any'> | undefined | null;
Example #13
Source File: project.types.ts    From relate with GNU General Public License v3.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject)
    metadata: Record<string, any>;
Example #14
Source File: dbms-plugins.types.ts    From relate with GNU General Public License v3.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject)
    config: DbmsPluginConfig;
Example #15
Source File: dbms.types.ts    From relate with GNU General Public License v3.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject)
    metadata: Record<string, any>;
Example #16
Source File: auth-token.input.ts    From relate with GNU General Public License v3.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject, {nullable: true})
    parameters?: Record<string, any>;
Example #17
Source File: notification.resolver.ts    From hakka with MIT License 5 votes vote down vote up
@Field((type) => GraphQLJSONObject)
  data: any
Example #18
Source File: module.ts    From backstage with Apache License 2.0 5 votes vote down vote up
export async function createModule(options: ModuleOptions): Promise<Module> {
  const catalogClient = new CatalogClient(
    options.config.getString('backend.baseUrl'),
  );

  const resolvers: Resolvers = {
    JSON: GraphQLJSON,
    JSONObject: GraphQLJSONObject,
    DefaultEntitySpec: {
      raw: rootValue => {
        const { entity } = rootValue as { entity: Entity };
        return entity.spec ?? null;
      },
    },
    Query: {
      catalog: () => ({} as CatalogQuery),
    },
    CatalogQuery: {
      list: async () => {
        return await catalogClient.list();
      },
    },
    CatalogEntity: {
      metadata: entity => ({ ...entity.metadata!, entity }),
      spec: entity => ({ ...entity.spec!, entity }),
    },
    EntityMetadata: {
      __resolveType: rootValue => {
        const {
          entity: { kind },
        } = rootValue as { entity: Entity };

        switch (kind) {
          case 'Component':
            return 'ComponentMetadata';
          case 'Template':
            return 'TemplateMetadata';
          default:
            return 'DefaultEntityMetadata';
        }
      },
      annotation: (e, { name }) => e.annotations?.[name] ?? null,
      labels: e => e.labels ?? {},
      annotations: e => e.annotations ?? {},
      label: (e, { name }) => e.labels?.[name] ?? null,
    },
    EntitySpec: {
      __resolveType: rootValue => {
        const {
          entity: { kind },
        } = rootValue as { entity: Entity };

        switch (kind) {
          case 'Component':
            return 'ComponentEntitySpec';
          case 'Template':
            return 'TemplateEntitySpec';
          default:
            return 'DefaultEntitySpec';
        }
      },
    },
  };

  return createGraphQLModule({
    id: 'plugin-catalog-graphql',
    typeDefs: gql(typeDefs),
    resolvers,
  });
}
Example #19
Source File: Notification.ts    From convoychat with GNU General Public License v3.0 5 votes vote down vote up
@Field(type => GraphQLJSONObject)
  @prop({ default: {} })
  public payload?: Object;
Example #20
Source File: EntityField.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject, {
    nullable: true,
    description: undefined
  })
  properties!: JsonValue;
Example #21
Source File: BlockVersion.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject, {
    nullable: true,
    description: undefined
  })
  settings?: JsonValue;
Example #22
Source File: EntityFieldUpdateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject, {
    nullable: true,
    description: undefined
  })
  properties?: JsonObject | null;
Example #23
Source File: EntityFieldCreateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject, {
    nullable: false,
    description: undefined
  })
  properties!: JsonObject;
Example #24
Source File: ActionLog.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => GraphQLJSONObject)
  meta!: JsonValue;
Example #25
Source File: user.resolver.ts    From Cromwell with MIT License 5 votes vote down vote up
@FieldResolver(() => GraphQLJSONObject, { nullable: true })
    async customMeta(@Root() entity: User, @Arg("keys", () => [String]) fields: string[]): Promise<any> {
        return entityMetaRepository.getEntityMetaByKeys(EDBEntity.User, entity.id, fields);
    }
Example #26
Source File: coupon.resolver.ts    From Cromwell with MIT License 5 votes vote down vote up
@FieldResolver(() => GraphQLJSONObject, { nullable: true })
    async customMeta(@Root() entity: Coupon, @Arg("keys", () => [String]) fields: string[]): Promise<any> {
        return entityMetaRepository.getEntityMetaByKeys(EDBEntity.Coupon, entity.id, fields);
    }
Example #27
Source File: custom-entity.resolver.ts    From Cromwell with MIT License 5 votes vote down vote up
@FieldResolver(() => GraphQLJSONObject, { nullable: true })
    async customMeta(@Root() entity: CustomEntity, @Arg("keys", () => [String]) fields: string[]): Promise<any> {
        return entityMetaRepository.getEntityMetaByKeys(EDBEntity.CustomEntity, entity.id, fields);
    }
Example #28
Source File: order.resolver.ts    From Cromwell with MIT License 5 votes vote down vote up
@FieldResolver(() => GraphQLJSONObject, { nullable: true })
    async customMeta(@Root() entity: Order, @Arg("keys", () => [String]) fields: string[]): Promise<any> {
        return entityMetaRepository.getEntityMetaByKeys(EDBEntity.Order, entity.id, fields);
    }
Example #29
Source File: whispCount.entity.ts    From whispr with MIT License 5 votes vote down vote up
@Field(() => GraphQLJSONObject, { nullable: true })
  _id: any;