Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contember/client-content

Package Overview
Dependencies
Maintainers
5
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/client-content - npm Package Compare versions

Comparing version 1.3.0-alpha.22 to 1.3.0-alpha.23

74

dist/types/nodes/TypedEntitySelection.d.ts

@@ -1,5 +0,4 @@

import { EntityTypeLike, SchemaTypeLike } from '../types/Schema';
import { EntityTypeLike, SchemaTypeLike } from '../types';
import { ContentClientInput } from '../types';
import { ContentEntitySelectionContext } from './ContentEntitySelection';
export type TypedEntitySelectionCallback<TSchema extends SchemaTypeLike, EntityName extends string, TEntity extends EntityTypeLike, TValue> = (select: TypedEntitySelection<TSchema, EntityName, TEntity, {}>) => TypedEntitySelection<TSchema, EntityName, TEntity, TValue>;
export interface TypedEntitySelection<TSchema extends SchemaTypeLike, TEntityName extends string, TEntity extends EntityTypeLike, TValue> {

@@ -11,36 +10,43 @@ /** @internal */

}>;
$<TKey extends (keyof TEntity['columns']) & string, TAlias extends string | null = null>(name: TKey, args?: {
as?: TAlias;
}): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TKey : TAlias]: TEntity['columns'][key];
$<TNestedValue, TKey extends (keyof TEntity['columns'] | keyof TEntity['hasMany'] | keyof TEntity['hasManyBy'] | keyof TEntity['hasOne']) & string, TAlias extends string | null = null>(name: TKey, ...args: TypedEntitySelectionParams<TSchema, TEntity, TKey, TNestedValue, TAlias>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TKey : TAlias]: TypedEntitySelectionResult<TEntity, TKey, TNestedValue>;
}>;
$<TNestedValue, TNestedKey extends keyof TEntity['hasMany'] & string, TAlias extends string | null = null>(name: TNestedKey, args: ContentClientInput.HasManyRelationInput<TEntity['hasMany'][TNestedKey]> & {
as?: TAlias;
}, fields: TypedEntitySelectionCallback<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue[];
}>;
$<TNestedValue, TNestedKey extends keyof TEntity['hasMany'] & string, TAlias extends string | null = null>(name: TNestedKey, fields: TypedEntitySelectionCallback<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue[];
}>;
$<TNestedValue, TNestedKey extends keyof TEntity['hasManyBy'] & string, TAlias extends string | null = null>(name: TNestedKey, args: ContentClientInput.HasManyByRelationInput<TEntity['hasManyBy'][TNestedKey]['entity'], TEntity['hasManyBy'][TNestedKey]['by']> & {
as?: TAlias;
}, fields: TypedEntitySelectionCallback<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: null | TNestedValue;
}>;
$<TNestedValue, TNestedKey extends keyof TEntity['hasManyBy'] & string, TAlias extends string | null = null>(name: TNestedKey, fields: TypedEntitySelectionCallback<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: null | TNestedValue;
}>;
$<TNestedValue extends {
[K in string]: unknown;
}, TNestedKey extends keyof TEntity['hasOne'] & string, TAlias extends string | null = null>(name: TNestedKey, args: ContentClientInput.HasOneRelationInput<TEntity['hasOne'][TNestedKey]> & {
as?: TAlias;
}, fields: TypedEntitySelectionCallback<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue | null;
}>;
$<TNestedValue extends {
[K in string]: unknown;
}, TNestedKey extends keyof TEntity['hasOne'] & string, TAlias extends string | null = null>(name: TNestedKey, fields: TypedEntitySelectionCallback<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue>): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue | null;
}>;
}
export type TypedEntitySelectionCallback<TSchema extends SchemaTypeLike, EntityName extends string, TEntity extends EntityTypeLike, TValue> = (select: TypedEntitySelection<TSchema, EntityName, TEntity, {}>) => TypedEntitySelection<TSchema, EntityName, TEntity, TValue>;
export type TypedHasManyArgs<TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasMany'] & string, TAlias extends string | null = null> = ContentClientInput.HasManyRelationInput<TEntity['hasMany'][TKey]> & {
as?: TAlias;
};
export type TypedHasManyFields<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasMany'] & string, TNestedValue> = TypedEntitySelectionCallback<TSchema, TEntity['hasMany'][TKey]['name'], TEntity['hasMany'][TKey], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasMany'][TKey]['name'], TEntity['hasMany'][TKey], TNestedValue>;
export type TypedHasManyParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasMany'] & string, TNestedValue, TAlias extends string | null = null> = [
args: TypedHasManyArgs<TEntity, TKey, TAlias>,
fields: TypedHasManyFields<TSchema, TEntity, TKey, TNestedValue>
] | [
fields: TypedHasManyFields<TSchema, TEntity, TKey, TNestedValue>
];
export type TypedHasManyByArgs<TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasManyBy'] & string, TAlias extends string | null = null> = ContentClientInput.HasManyByRelationInput<TEntity['hasManyBy'][TKey]['entity'], TEntity['hasManyBy'][TKey]['by']> & {
as?: TAlias;
};
export type TypedHasManyByFields<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasManyBy'] & string, TNestedValue> = TypedEntitySelectionCallback<TSchema, TEntity['hasManyBy'][TKey]['entity']['name'], TEntity['hasManyBy'][TKey]['entity'], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasManyBy'][TKey]['entity']['name'], TEntity['hasManyBy'][TKey]['entity'], TNestedValue>;
export type TypedHasManyByParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasManyBy'] & string, TNestedValue, TAlias extends string | null = null> = [
args: TypedHasManyByArgs<TEntity, TKey, TAlias>,
fields: TypedHasManyByFields<TSchema, TEntity, TKey, TNestedValue>
];
export type TypedHasOneArgs<TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasOne'] & string, TAlias extends string | null = null> = ContentClientInput.HasOneRelationInput<TEntity['hasOne'][TKey]> & {
as?: TAlias;
};
export type TypedHasOneFields<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasOne'] & string, TNestedValue> = TypedEntitySelectionCallback<TSchema, TEntity['hasOne'][TKey]['name'], TEntity['hasOne'][TKey], TNestedValue> | TypedEntitySelection<TSchema, TEntity['hasOne'][TKey]['name'], TEntity['hasOne'][TKey], TNestedValue>;
export type TypedHasOneParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasOne'] & string, TNestedValue, TAlias extends string | null = null> = [
args: TypedHasOneArgs<TEntity, TKey, TAlias>,
fields: TypedHasOneFields<TSchema, TEntity, TKey, TNestedValue>
] | [
fields: TypedHasOneFields<TSchema, TEntity, TKey, TNestedValue>
];
export type TypedColumnArgs<TAlias extends string | null = null> = {
as?: TAlias;
};
export type TypedColumnParams<TAlias extends string | null = null> = [
args: TypedColumnArgs<TAlias>
] | [];
export type TypedEntitySelectionParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends string, TNestedValue, TAlias extends string | null = null> = TKey extends keyof TEntity['columns'] ? TypedColumnParams<TAlias> : TKey extends keyof TEntity['hasMany'] ? TypedHasManyParams<TSchema, TEntity, TKey, TNestedValue, TAlias> : TKey extends keyof TEntity['hasManyBy'] ? TypedHasManyByParams<TSchema, TEntity, TKey, TNestedValue, TAlias> : TKey extends keyof TEntity['hasOne'] ? TypedHasOneParams<TSchema, TEntity, TKey, TNestedValue, TAlias> : never;
export type TypedEntitySelectionResult<TEntity extends EntityTypeLike, TKey extends string, TValue> = TKey extends keyof TEntity['columns'] ? TEntity['columns'][TKey] : TKey extends keyof TEntity['hasMany'] ? TValue[] : TKey extends keyof TEntity['hasManyBy'] ? null | TValue : TKey extends keyof TEntity['hasOne'] ? null | TValue : never;
//# sourceMappingURL=TypedEntitySelection.d.ts.map
{
"name": "@contember/client-content",
"license": "Apache-2.0",
"version": "1.3.0-alpha.22",
"version": "1.3.0-alpha.23",
"main": "./dist/production/index.js",

@@ -38,8 +38,8 @@ "exports": {

"dependencies": {
"@contember/graphql-builder": "1.3.0-alpha.22",
"@contember/graphql-client": "1.3.0-alpha.22",
"@contember/graphql-builder": "1.3.0-alpha.23",
"@contember/graphql-client": "1.3.0-alpha.23",
"@contember/schema": "^1.3.6"
},
"devDependencies": {
"@contember/client-content-generator": "1.3.0-alpha.22"
"@contember/client-content-generator": "1.3.0-alpha.23"
},

@@ -46,0 +46,0 @@ "repository": {

@@ -1,11 +0,5 @@

import { EntityTypeLike, SchemaTypeLike } from '../types/Schema'
import { EntityTypeLike, SchemaTypeLike } from '../types'
import { ContentClientInput } from '../types'
import { ContentEntitySelectionContext } from './ContentEntitySelection'
export type TypedEntitySelectionCallback<
TSchema extends SchemaTypeLike,
EntityName extends string,
TEntity extends EntityTypeLike,
TValue
> = (select: TypedEntitySelection<TSchema, EntityName, TEntity, {}>) => TypedEntitySelection<TSchema, EntityName, TEntity, TValue>

@@ -22,91 +16,91 @@ export interface TypedEntitySelection<TSchema extends SchemaTypeLike, TEntityName extends string, TEntity extends EntityTypeLike, TValue> {

$<
TKey extends (keyof TEntity['columns']) & string,
TNestedValue,
TKey extends (keyof TEntity['columns'] | keyof TEntity['hasMany'] | keyof TEntity['hasManyBy'] | keyof TEntity['hasOne']) & string,
TAlias extends string | null = null
>(
name: TKey,
args?: {as?: TAlias},
...args: TypedEntitySelectionParams<TSchema, TEntity, TKey, TNestedValue, TAlias>
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TKey : TAlias]: TEntity['columns'][key]
[key in TAlias extends null ? TKey : TAlias]: TypedEntitySelectionResult<TEntity, TKey, TNestedValue>
}>
}
$<
TNestedValue,
TNestedKey extends keyof TEntity['hasMany'] & string,
TAlias extends string | null = null,
>(
name: TNestedKey,
args: ContentClientInput.HasManyRelationInput<TEntity['hasMany'][TNestedKey]> & { as?: TAlias },
fields:
| TypedEntitySelectionCallback<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue>,
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue[]
}>
export type TypedEntitySelectionCallback<
TSchema extends SchemaTypeLike,
EntityName extends string,
TEntity extends EntityTypeLike,
TValue,
> = (select: TypedEntitySelection<TSchema, EntityName, TEntity, {}>) => TypedEntitySelection<TSchema, EntityName, TEntity, TValue>
$<
TNestedValue,
TNestedKey extends keyof TEntity['hasMany'] & string,
TAlias extends string | null = null,
>(
name: TNestedKey,
fields:
| TypedEntitySelectionCallback<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasMany'][TNestedKey]['name'], TEntity['hasMany'][TNestedKey], TNestedValue>,
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue[]
}>
$<
TNestedValue,
TNestedKey extends keyof TEntity['hasManyBy'] & string,
TAlias extends string | null = null,
>(
name: TNestedKey,
args: ContentClientInput.HasManyByRelationInput<TEntity['hasManyBy'][TNestedKey]['entity'], TEntity['hasManyBy'][TNestedKey]['by']> & { as?: TAlias },
fields:
| TypedEntitySelectionCallback<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue>,
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: null | TNestedValue
}>
export type TypedHasManyArgs<TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasMany'] & string, TAlias extends string | null = null> =
& ContentClientInput.HasManyRelationInput<TEntity['hasMany'][TKey]>
& { as?: TAlias }
$<
TNestedValue,
TNestedKey extends keyof TEntity['hasManyBy'] & string,
TAlias extends string | null = null,
>(
name: TNestedKey,
fields:
| TypedEntitySelectionCallback<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasManyBy'][TNestedKey]['entity']['name'], TEntity['hasManyBy'][TNestedKey]['entity'], TNestedValue>,
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: null | TNestedValue
}>
export type TypedHasManyFields<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasMany'] & string, TNestedValue> =
| TypedEntitySelectionCallback<TSchema, TEntity['hasMany'][TKey]['name'], TEntity['hasMany'][TKey], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasMany'][TKey]['name'], TEntity['hasMany'][TKey], TNestedValue>
$<
TNestedValue extends { [K in string]: unknown },
TNestedKey extends keyof TEntity['hasOne'] & string,
TAlias extends string | null = null,
>(
name: TNestedKey,
args: ContentClientInput.HasOneRelationInput<TEntity['hasOne'][TNestedKey]> & { as?: TAlias },
fields:
| TypedEntitySelectionCallback<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue>,
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue | null
}>
export type TypedHasManyParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasMany'] & string, TNestedValue, TAlias extends string | null = null> =
| [
args: TypedHasManyArgs<TEntity, TKey, TAlias>,
fields: TypedHasManyFields<TSchema, TEntity, TKey, TNestedValue>,
]
| [
fields: TypedHasManyFields<TSchema, TEntity, TKey, TNestedValue>,
]
$<
TNestedValue extends { [K in string]: unknown },
TNestedKey extends keyof TEntity['hasOne'] & string,
TAlias extends string | null = null,
>(
name: TNestedKey,
fields:
| TypedEntitySelectionCallback<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasOne'][TNestedKey]['name'], TEntity['hasOne'][TNestedKey], TNestedValue>,
): TypedEntitySelection<TSchema, TEntityName, TEntity, TValue & {
[key in TAlias extends null ? TNestedKey : TAlias]: TNestedValue | null
}>
}
export type TypedHasManyByArgs<TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasManyBy'] & string, TAlias extends string | null = null> =
& ContentClientInput.HasManyByRelationInput<TEntity['hasManyBy'][TKey]['entity'], TEntity['hasManyBy'][TKey]['by']>
& { as?: TAlias }
export type TypedHasManyByFields<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasManyBy'] & string, TNestedValue> =
| TypedEntitySelectionCallback<TSchema, TEntity['hasManyBy'][TKey]['entity']['name'], TEntity['hasManyBy'][TKey]['entity'], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasManyBy'][TKey]['entity']['name'], TEntity['hasManyBy'][TKey]['entity'], TNestedValue>
export type TypedHasManyByParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasManyBy'] & string, TNestedValue, TAlias extends string | null = null> =
| [
args: TypedHasManyByArgs<TEntity, TKey, TAlias>,
fields: TypedHasManyByFields<TSchema, TEntity, TKey, TNestedValue>
]
export type TypedHasOneArgs<TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasOne'] & string, TAlias extends string | null = null> =
& ContentClientInput.HasOneRelationInput<TEntity['hasOne'][TKey]>
& { as?: TAlias }
export type TypedHasOneFields<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasOne'] & string, TNestedValue> =
| TypedEntitySelectionCallback<TSchema, TEntity['hasOne'][TKey]['name'], TEntity['hasOne'][TKey], TNestedValue>
| TypedEntitySelection<TSchema, TEntity['hasOne'][TKey]['name'], TEntity['hasOne'][TKey], TNestedValue>
export type TypedHasOneParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends keyof TEntity['hasOne'] & string, TNestedValue, TAlias extends string | null = null> =
| [
args: TypedHasOneArgs<TEntity, TKey, TAlias>,
fields: TypedHasOneFields<TSchema, TEntity, TKey, TNestedValue>
]
| [
fields: TypedHasOneFields<TSchema, TEntity, TKey, TNestedValue>
]
export type TypedColumnArgs<TAlias extends string | null = null> = { as?: TAlias }
export type TypedColumnParams<TAlias extends string | null = null> =
| [
args: TypedColumnArgs<TAlias>
]
| []
export type TypedEntitySelectionParams<TSchema extends SchemaTypeLike, TEntity extends EntityTypeLike, TKey extends string, TNestedValue, TAlias extends string | null = null> =
TKey extends keyof TEntity['columns'] ? TypedColumnParams<TAlias>
: TKey extends keyof TEntity['hasMany'] ? TypedHasManyParams<TSchema, TEntity, TKey, TNestedValue, TAlias>
: TKey extends keyof TEntity['hasManyBy'] ? TypedHasManyByParams<TSchema, TEntity, TKey, TNestedValue, TAlias>
: TKey extends keyof TEntity['hasOne'] ? TypedHasOneParams<TSchema, TEntity, TKey, TNestedValue, TAlias>
: never
export type TypedEntitySelectionResult<TEntity extends EntityTypeLike, TKey extends string, TValue> =
TKey extends keyof TEntity['columns'] ? TEntity['columns'][TKey]
: TKey extends keyof TEntity['hasMany'] ? TValue[]
: TKey extends keyof TEntity['hasManyBy'] ? null | TValue
: TKey extends keyof TEntity['hasOne'] ? null | TValue
: never

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc