@strapi/types 4.14.3 → 4.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import type { Attribute, Common, Utils } from '../../../types';
1
+ import type { Attribute, Common, Utils, Entity } from '../../../types';
2
2
  export type NonFilterableKind = Extract<Attribute.Kind, 'password' | 'dynamiczone'>;
3
3
  export type FilterableKind = Exclude<Attribute.Kind, NonFilterableKind>;
4
4
  export type GetNonFilterableKeys<TSchemaUID extends Common.UID.Schema> = Utils.Object.KeysBy<Attribute.GetAll<TSchemaUID>, Attribute.OfType<NonFilterableKind>, string>;
5
5
  export type GetScalarKeys<TSchemaUID extends Common.UID.Schema> = Exclude<Attribute.GetKeysByType<TSchemaUID, Attribute.NonPopulatableKind>, GetNonFilterableKeys<TSchemaUID>>;
6
6
  export type GetNestedKeys<TSchemaUID extends Common.UID.Schema> = Exclude<Attribute.GetKeysWithTarget<TSchemaUID>, GetNonFilterableKeys<TSchemaUID>>;
7
- export type ID = `${number}` | number;
7
+ export type ID = Entity.ID;
8
8
  export type BooleanValue = boolean | 'true' | 'false' | 't' | 'f' | '1' | '0' | 1 | 0;
9
9
  export type NumberValue = string | number;
10
10
  export type DateValue = Attribute.DateValue | number;
@@ -7,4 +7,4 @@ export interface ComponentProperties<TComponentUID extends Common.UID.Component,
7
7
  export type Component<TComponentUID extends Common.UID.Component = Common.UID.Component, TRepeatable extends Utils.Expression.BooleanValue = Utils.Expression.False> = Attribute.OfType<'component'> & ComponentProperties<TComponentUID, TRepeatable> & Attribute.ConfigurableOption & Attribute.MinMaxOption & Attribute.PrivateOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption;
8
8
  export type ComponentValue<TComponentUID extends Common.UID.Component, TRepeatable extends Utils.Expression.BooleanValue> = Attribute.GetValues<TComponentUID> extends infer TValues ? Utils.Expression.If<TRepeatable, TValues[], TValues> : never;
9
9
  export type GetComponentValue<TAttribute extends Attribute.Attribute> = TAttribute extends Component<infer TComponentUID, infer TRepeatable> ? ComponentValue<TComponentUID, TRepeatable> : never;
10
- export type GetComponentTarget<TAttribute extends Attribute.Attribute> = TAttribute extends Component<infer TComponentUID, infer _TRepeatable> ? TComponentUID : never;
10
+ export type GetComponentTarget<TAttribute extends Attribute.Attribute> = TAttribute extends Component<infer TComponentUID> ? TComponentUID : never;
@@ -9,4 +9,4 @@ export interface MediaProperties<TKind extends MediaKind | undefined = undefined
9
9
  export type Media<TKind extends MediaKind | undefined = undefined, TMultiple extends Utils.Expression.BooleanValue = Utils.Expression.False> = Attribute.OfType<'media'> & MediaProperties<TKind, TMultiple> & Attribute.ConfigurableOption & Attribute.RequiredOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption;
10
10
  export type MediaValue<TMultiple extends Utils.Expression.BooleanValue = Utils.Expression.False> = Utils.Expression.If<TMultiple, any[], any>;
11
11
  export type GetMediaValue<TAttribute extends Attribute.Attribute> = TAttribute extends Media<infer _TKind, infer TMultiple> ? MediaValue<TMultiple> : never;
12
- export type GetMediaTarget<TAttribute extends Attribute.Attribute> = TAttribute extends Media<infer _TKind, infer _TMultiple> ? MediaTarget : never;
12
+ export type GetMediaTarget<TAttribute extends Attribute.Attribute> = TAttribute extends Media ? MediaTarget : never;
@@ -12,4 +12,4 @@ export interface UIDProperties<TTargetAttribute extends string = string, TOption
12
12
  }
13
13
  export type UID<_TOrigin extends Common.UID.Schema = never, TTargetAttribute extends string = string, TOptions extends UIDOptions = UIDOptions> = Attribute.OfType<'uid'> & UIDProperties<TTargetAttribute, TOptions> & Attribute.ConfigurableOption & Attribute.DefaultOption<UIDValue> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption;
14
14
  export type UIDValue = string;
15
- export type GetUIDValue<TAttribute extends Attribute.Attribute> = TAttribute extends UID<infer _TOrigin, infer _TTargetAttribute> ? UIDValue : never;
15
+ export type GetUIDValue<TAttribute extends Attribute.Attribute> = TAttribute extends UID ? UIDValue : never;
@@ -1,4 +1,4 @@
1
- import type { Attribute, Common } from '..';
1
+ import type { Attribute, Common, Entity } from '..';
2
2
  import type { Utils } from '../..';
3
3
  export type GetKeysByType<TSchemaUID extends Common.UID.Schema, TKind extends Attribute.Kind, TCondition = never> = Utils.Object.KeysBy<GetAll<TSchemaUID>, Attribute.OfType<TKind> & Utils.Guard.Never<TCondition, unknown>, string>;
4
4
  export type GetByType<TSchemaUID extends Common.UID.Schema, TKind extends Attribute.Kind, TCondition = never> = Utils.Object.PickBy<GetAll<TSchemaUID>, Attribute.OfType<TKind> & Utils.Guard.Never<TCondition, unknown>>;
@@ -15,7 +15,7 @@ export type GetKeysWithTarget<TSchemaUID extends Common.UID.Schema> = keyof {
15
15
  export type GetValue<TAttribute extends Attribute.Attribute, TGuard = unknown> = Utils.Guard.Never<Attribute.GetBigIntegerValue<TAttribute> | Attribute.GetBooleanValue<TAttribute> | Attribute.GetBlocksValue<TAttribute> | Attribute.GetComponentValue<TAttribute> | Attribute.GetDecimalValue<TAttribute> | Attribute.GetDynamicZoneValue<TAttribute> | Attribute.GetEnumerationValue<TAttribute> | Attribute.GetEmailValue<TAttribute> | Attribute.GetFloatValue<TAttribute> | Attribute.GetIntegerValue<TAttribute> | Attribute.GetJsonValue<TAttribute> | Attribute.GetMediaValue<TAttribute> | Attribute.GetPasswordValue<TAttribute> | Attribute.GetRelationValue<TAttribute> | Attribute.GetRichTextValue<TAttribute> | Attribute.GetStringValue<TAttribute> | Attribute.GetTextValue<TAttribute> | Attribute.GetUIDValue<TAttribute> | Attribute.GetDateValue<TAttribute> | Attribute.GetDateTimeValue<TAttribute> | Attribute.GetTimeValue<TAttribute> | Attribute.GetTimestampValue<TAttribute>, TGuard>;
16
16
  export type GetValueByKey<TSchemaUID extends Common.UID.Schema, TKey extends GetKeys<TSchemaUID>> = Get<TSchemaUID, TKey> extends infer TAttribute extends Attribute.Attribute ? GetValue<TAttribute> : never;
17
17
  export type GetValues<TSchemaUID extends Common.UID.Schema, TKey extends GetKeys<TSchemaUID> = GetKeys<TSchemaUID>> = {
18
- id: number | `${number}`;
18
+ id: Entity.ID;
19
19
  } & {
20
20
  [key in GetRequiredKeys<TSchemaUID> as key extends TKey ? key : never]-?: GetValueByKey<TSchemaUID, key>;
21
21
  } & {
@@ -0,0 +1 @@
1
+ export type ID = number | string;
@@ -10,6 +10,7 @@
10
10
  export * as Attribute from './attributes';
11
11
  export * as Schema from './schemas';
12
12
  export * as Plugin from './plugins';
13
+ export * as Entity from './entity';
13
14
  export * from './strapi';
14
15
  export * as Common from './common';
15
16
  export * as Namespace from './namespace';
@@ -1,8 +1,9 @@
1
- import type { Common, Utils } from '..';
1
+ import type { Common, Utils, Entity as E } from '..';
2
+ type EntityID = E.ID;
2
3
  type Entity = {
3
- id: string | number;
4
+ id: EntityID;
4
5
  } & Record<string, unknown>;
5
- type PaginatedEntiies = {
6
+ type PaginatedEntities = {
6
7
  results: Entity[];
7
8
  pagination: {
8
9
  page: number;
@@ -33,17 +34,17 @@ export type Generic = {
33
34
  * Core-API collection type service
34
35
  */
35
36
  export interface CollectionType extends Base {
36
- find(params: object): Promise<PaginatedEntiies>;
37
- findOne(entityId: number | `${number}`, params: object): Promise<Entity | null>;
37
+ find(params: object): Promise<PaginatedEntities>;
38
+ findOne(entityId: EntityID, params: object): Promise<Entity | null>;
38
39
  create(params: {
39
40
  data: Data;
40
41
  [key: string]: unknown;
41
42
  }): Promise<Entity>;
42
- update(entityId: number | `${number}`, params: {
43
+ update(entityId: EntityID, params: {
43
44
  data: Data;
44
45
  [key: string]: unknown;
45
46
  }): Promise<Entity> | Entity;
46
- delete(entityId: number | `${number}`, params: object): Promise<Entity> | Entity;
47
+ delete(entityId: EntityID, params: object): Promise<Entity> | Entity;
47
48
  }
48
49
  /**
49
50
  * Core-API single type service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/types",
3
- "version": "4.14.3",
3
+ "version": "4.14.4",
4
4
  "description": "Shared typescript types for Strapi internal use",
5
5
  "keywords": [
6
6
  "strapi"
@@ -45,29 +45,29 @@
45
45
  "dependencies": {
46
46
  "@koa/cors": "3.4.3",
47
47
  "@koa/router": "10.1.1",
48
- "@strapi/database": "4.14.3",
49
- "@strapi/logger": "4.14.3",
50
- "@strapi/permissions": "4.14.3",
51
- "@strapi/utils": "4.14.3",
48
+ "@strapi/database": "4.14.4",
49
+ "@strapi/logger": "4.14.4",
50
+ "@strapi/permissions": "4.14.4",
51
+ "@strapi/utils": "4.14.4",
52
52
  "commander": "8.3.0",
53
53
  "https-proxy-agent": "5.0.1",
54
54
  "koa": "2.13.4",
55
55
  "node-fetch": "2.7.0",
56
- "node-schedule": "2.1.0",
57
- "ts-zen": "https://github.com/strapi/ts-zen#66e02232f5997674cc7032ea3ee59d9864863732"
56
+ "node-schedule": "2.1.0"
58
57
  },
59
58
  "devDependencies": {
59
+ "@strapi/ts-zen": "^0.2.0",
60
60
  "@types/jest": "29.5.2",
61
61
  "@types/koa": "2.13.4",
62
62
  "@types/koa__router": "12.0.0",
63
63
  "@types/node-schedule": "2.1.0",
64
- "eslint-config-custom": "4.14.3",
65
- "tsconfig": "4.14.3",
64
+ "eslint-config-custom": "4.14.4",
65
+ "tsconfig": "4.14.4",
66
66
  "typescript": "5.2.2"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=16.0.0 <=20.x.x",
70
70
  "npm": ">=6.0.0"
71
71
  },
72
- "gitHead": "f509e0b15d77e2475bdc1ada1b26dd0ba2b1dbca"
72
+ "gitHead": "fbd6e3e3014b1c5eee1d7bb8d65e273318662656"
73
73
  }