dryvPacks

@dryv/nestjsv0.9.0

NestJS feature controllers, services and modules for HTTP operations.

NestJS Backend AdapterBackendInjectPublished 7 days ago2 downloads

dryv pack add @dryv/nestjs
1.4 KBRaw ↗
jinja
{%- macro symbol_for(link) -%}{% for dependency in file.dependencies if dependency.target.id == link.id %}{{ dependency.symbol }}{% endfor %}{%- endmacro -%}
{%- macro type_of(value) -%}
{%- if value.is.schema -%}{{ symbol_for(value.schema) }}
{%- elif value.is.primitive -%}{{ value.property.primitive.type }}
{%- elif value.is.enum -%}{% for item in value.property.enum.values %}{{ item.value | tojson }}{% if not loop.last %} | {% endif %}{% endfor %}
{%- elif value.is.temporal -%}string
{%- elif value.is.record -%}Record<string, {{ value.property.record.values.name }}>
{%- elif value.is.geometry -%}GeoJson
{%- elif value.is.dynamic -%}JsonValue
{%- else -%}unknown
{%- endif -%}
{%- endmacro -%}
import type { GeoJson } from '{{ file.path.import_base }}geo-json.ts';
{%- for dependency in file.dependencies if dependency.symbol and not dependency.is_self %}
import type { {{ dependency.symbol }} } from '{{ dependency.path.prefixed }}';
{%- endfor %}
type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };
/** Test-owned entity declaration, independent of the consumer's general type pack. */
export interface {{ file.symbol }} {
{% for field in schema.fields %}
  {{ field.name.raw }}{% if field.optional %}?{% endif %}: ({% if field.array is not none %}Array<{% endif %}{{ type_of(field.value) }}{% if field.array is not none %}>{% endif %}){% if field.nullable %} | null{% endif %};
{% endfor %}
}