type-fest#JsonValue TypeScript Examples

The following examples show how to use type-fest#JsonValue. 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: 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 #2
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 #3
Source File: action.service.ts    From amplication with Apache License 2.0 6 votes vote down vote up
/**
   * Logs given message with given level and given meta for given step
   * @param step the step to add log for
   * @param message the log message to add to step
   * @param meta metadata to add for the log
   */
  async log(
    step: ActionStep,
    level: EnumActionLogLevel,
    message: { toString(): string },
    meta: JsonValue = {}
  ): Promise<void> {
    await this.prisma.actionLog.create({
      data: {
        level,
        message: message.toString(),
        meta,
        step: {
          connect: { id: step.id }
        }
      },
      select: SELECT_ID
    });
  }
Example #4
Source File: action.service.ts    From amplication with Apache License 2.0 6 votes vote down vote up
/**
   * Logs given message with given meta with Info level for given step
   * @param step the step to add log for
   * @param message the log message to add to step
   * @param meta metadata to add for the log
   */
  async logInfo(
    step: ActionStep,
    message: string,
    meta: JsonValue = {}
  ): Promise<void> {
    await this.log(step, EnumActionLogLevel.Info, message, meta);
  }
Example #5
Source File: Cookie.ts    From ZenTS with MIT License 6 votes vote down vote up
constructor(headers: IncomingHttpHeaders) {
    const cookies = parse(headers.cookie ?? '')

    for (const [key, value] of Object.entries(cookies)) {
      try {
        const cookieValue = JSON.parse(value) as JsonValue

        this.data.set(key, {
          value: cookieValue,
          options: this.getCookieOptions(),
        })
      } catch (e) {
        // silent
      }
    }
  }
Example #6
Source File: Cookie.ts    From ZenTS with MIT License 6 votes vote down vote up
public set(
    key: string,
    value: JsonValue,
    options?: Except<CookieOptions, 'enable' | 'strategy'>,
  ): void {
    this.modifiedKeys.add(key)
    this.data.set(key, {
      value,
      options: this.getCookieOptions(options),
    })
  }
Example #7
Source File: jsonHelper.ts    From amplication with Apache License 2.0 6 votes vote down vote up
async updateValue(name: string, value: JsonValue): Promise<boolean> {
    let packageJson = await this.packageJson;
    if (packageJson) {
      packageJson[name] = value;
    } else {
      packageJson = {};
      packageJson[name] = value;
    }
    this.packageJson = Promise.resolve(packageJson);
    return await JsonHelper.write(this.path, packageJson);
  }
Example #8
Source File: EntityPageUpdateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@ValidateIf(o => o.pageType === EnumEntityPageType.List)
  @IsNotEmpty()
  @Field(() => EntityPageListSettings, {
    nullable: true
  })
  listSettings?: EntityPageListSettings & JsonValue;
Example #9
Source File: EntityPageCreateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@ValidateIf(o => o.pageType === EnumEntityPageType.SingleRecord)
  @IsNotEmpty()
  @Field(() => EntityPageSingleRecordSettings, {
    nullable: true
  })
  singleRecordSettings?: EntityPageSingleRecordSettings & JsonValue;
Example #10
Source File: entityPage.service.spec.ts    From amplication with Apache License 2.0 5 votes vote down vote up
EXAMPLE_SINGLE_RECORD_SETTINGS: EntityPageSingleRecordSettings &
  JsonValue = {
  allowCreation: true,
  allowDeletion: true,
  allowUpdate: true
}
Example #11
Source File: entityPage.service.spec.ts    From amplication with Apache License 2.0 5 votes vote down vote up
EXAMPLE_LIST_SETTINGS: EntityPageListSettings & JsonValue = {
  allowCreation: true,
  allowDeletion: true,
  enableSearch: false,
  navigateToPageId: 'ExamplePageId'
}
Example #12
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 #13
Source File: BlockVersion.ts    From amplication with Apache License 2.0 5 votes vote down vote up
inputParameters?: JsonValue;
Example #14
Source File: BlockVersion.ts    From amplication with Apache License 2.0 5 votes vote down vote up
outputParameters?: JsonValue;
Example #15
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 #16
Source File: jsonHelper.ts    From amplication with Apache License 2.0 5 votes vote down vote up
async getValue(name: string): Promise<JsonValue> {
    const packageJson = await this.packageJson;
    if (packageJson) {
      return packageJson[name];
    } else {
      return null;
    }
  }
Example #17
Source File: Cookie.ts    From ZenTS with MIT License 5 votes vote down vote up
protected data = new Map<
    string,
    {
      options: CookieOptions
      value: JsonValue
    }
  >()
Example #18
Source File: Request.ts    From ZenTS with MIT License 5 votes vote down vote up
protected _body: JsonValue
Example #19
Source File: Response.ts    From ZenTS with MIT License 5 votes vote down vote up
public json<T extends JsonValue>(data: T): this {
    this._body = data
    this.header.setContentType('application/json')
    this.bodyType = RESPONSE_BODY_TYPE.JSON

    return this
  }
Example #20
Source File: EntityPageUpdateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@ValidateIf(o => o.pageType === EnumEntityPageType.SingleRecord)
  @IsNotEmpty()
  @Field(() => EntityPageSingleRecordSettings, {
    nullable: true
  })
  singleRecordSettings?: EntityPageSingleRecordSettings & JsonValue;
Example #21
Source File: EntityPageCreateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@ValidateIf(o => o.pageType === EnumEntityPageType.List)
  @IsNotEmpty()
  @Field(() => EntityPageListSettings, {
    nullable: true
  })
  listSettings?: EntityPageListSettings & JsonValue;
Example #22
Source File: JsonNullableFilter.ts    From amplication with Apache License 2.0 5 votes vote down vote up
equals?: JsonValue | null;
Example #23
Source File: EntityPage.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => EntityPageListSettings, {
    nullable: true
  })
  listSettings?: EntityPageListSettings & JsonValue;
Example #24
Source File: EntityPage.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => EntityPageSingleRecordSettings, {
    nullable: true
  })
  singleRecordSettings?: EntityPageSingleRecordSettings & JsonValue;
Example #25
Source File: Deployment.ts    From amplication with Apache License 2.0 5 votes vote down vote up
statusQuery?: JsonValue;
Example #26
Source File: ConnectorRestApiCreateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => HttpBasicAuthenticationSettings, {
    nullable: true,
    description: undefined
  })
  httpBasicAuthenticationSettings: HttpBasicAuthenticationSettings & JsonValue;
Example #27
Source File: ConnectorRestApiCreateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => PrivateKeyAuthenticationSettings, {
    nullable: true,
    description: undefined
  })
  privateKeyAuthenticationSettings: PrivateKeyAuthenticationSettings &
    JsonValue;
Example #28
Source File: Build.ts    From amplication with Apache License 2.0 5 votes vote down vote up
containerStatusQuery?: JsonValue;
Example #29
Source File: BlockCreateInput.ts    From amplication with Apache License 2.0 5 votes vote down vote up
@Field(() => WhereParentIdInput, {
    nullable: true,
    description: undefined
  })
  parentBlock?: WhereParentIdInput & JsonValue;