@strapi/strapi 4.3.0-beta.1 → 4.3.0-beta.2

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.
Files changed (38) hide show
  1. package/bin/strapi.js +18 -1
  2. package/lib/commands/content-types/generate-types.js +20 -0
  3. package/lib/commands/opt-in-telemetry.js +100 -0
  4. package/lib/core/app-configuration/config-loader.js +3 -1
  5. package/lib/global.d.ts +61 -0
  6. package/lib/index.d.ts +2 -25
  7. package/lib/types/core/attributes/base.d.ts +74 -0
  8. package/lib/types/core/attributes/biginteger.d.ts +22 -0
  9. package/lib/types/core/attributes/boolean.d.ts +20 -0
  10. package/lib/types/core/attributes/common.d.ts +42 -0
  11. package/lib/types/core/attributes/component.d.ts +41 -0
  12. package/lib/types/core/attributes/date-time.d.ts +22 -0
  13. package/lib/types/core/attributes/date.d.ts +22 -0
  14. package/lib/types/core/attributes/decimal.d.ts +22 -0
  15. package/lib/types/core/attributes/dynamic-zone.d.ts +29 -0
  16. package/lib/types/core/attributes/email.d.ts +24 -0
  17. package/lib/types/core/attributes/enumeration.d.ts +28 -0
  18. package/lib/types/core/attributes/float.d.ts +22 -0
  19. package/lib/types/core/attributes/index.d.ts +26 -0
  20. package/lib/types/core/attributes/integer.d.ts +22 -0
  21. package/lib/types/core/attributes/json.d.ts +14 -0
  22. package/lib/types/core/attributes/media.d.ts +36 -0
  23. package/lib/types/core/attributes/password.d.ts +22 -0
  24. package/lib/types/core/attributes/relation.d.ts +66 -0
  25. package/lib/types/core/attributes/richtext.d.ts +22 -0
  26. package/lib/types/core/attributes/string.d.ts +30 -0
  27. package/lib/types/core/attributes/text.d.ts +30 -0
  28. package/lib/types/core/attributes/time.d.ts +22 -0
  29. package/lib/types/core/attributes/timestamp.d.ts +22 -0
  30. package/lib/types/core/attributes/uid.d.ts +57 -0
  31. package/lib/types/core/attributes/utils.d.ts +99 -0
  32. package/lib/types/core/index.d.ts +3 -0
  33. package/lib/types/core/schemas/index.d.ts +126 -0
  34. package/lib/types/{strapi.d.ts → core/strapi/index.d.ts} +0 -0
  35. package/lib/{factories.d.ts → types/factories.d.ts} +5 -5
  36. package/lib/types/index.d.ts +4 -0
  37. package/lib/types/utils.d.ts +95 -1
  38. package/package.json +17 -17
@@ -1 +1,95 @@
1
- export type StringMap<T> = { [key: string]: T };
1
+ /**
2
+ *
3
+ * Common utilities used across Strapi typings
4
+ *
5
+ * */
6
+
7
+ /**
8
+ *
9
+ * Extract the array values into an union type
10
+ *
11
+ **/
12
+ export type GetArrayValues<T extends Array<unknown>> = T extends Array<infer U> ? U : never;
13
+
14
+ /**
15
+ * Creates a record where every key is a string and every value is `T`
16
+ */
17
+ export type StringRecord<T> = Record<string, T>;
18
+
19
+ /**
20
+ * Retrieve object's (`T`) keys if they extends the given `U` type.
21
+ *
22
+ * @example
23
+ * type X = KeysBy<{ foo: 'bar', bar: 'foo', foobar: 2 }, string>
24
+ * // 'foo' | 'bar'
25
+ *
26
+ * type Base = { x: 'foo' | 'bar' };
27
+ * type Obj = { foo: { x: 'foo' }, bar: { x: 'bar' }, other: { x: '42' } };
28
+ * type X = KeysBy<Obj, Base>
29
+ * // 'foo' | 'bar'
30
+ */
31
+ export type KeysBy<T, U> = {
32
+ [key in keyof T]: T[key] extends U ? key : never;
33
+ }[keyof T];
34
+
35
+ /**
36
+ * Retrieve object's (`T`) properties if their value extends the given `U` type.
37
+ *
38
+ * @example
39
+ * type X = KeysBy<{ foo: 'bar', bar: 'foo', foobar: 2 }, string>
40
+ * // { foo: 'bar', bar: 'foo' }
41
+ *
42
+ * type Base = { x: 'foo' | 'bar' };
43
+ * type Obj = { foo: { x: 'foo' }, bar: { x: 'bar' }, other: { x: '42' } };
44
+ * type X = KeysBy<Obj, Base>
45
+ * // { foo: { x: 'foo' }, bar: { x: 'bar' } }
46
+ */
47
+ export type PickBy<T, U> = Pick<T, KeysBy<T, U>>;
48
+
49
+ /**
50
+ * Assign a default value `U` to `T` if `T` is of type `never`
51
+ *
52
+ * @example
53
+ * type X = NeverGuard<{ foo: 'bar' }, string>
54
+ * // { foo: 'bar' }
55
+ *
56
+ * type X = NeverGuard<never>
57
+ * // unknown
58
+ *
59
+ * type X = NeverGuard<never, string>
60
+ * // string
61
+ */
62
+ export type NeverGuard<T, U = unknown> = [T] extends [never] ? U : T;
63
+
64
+ /**
65
+ * Dynamic type based on the keys of `Strapi.Schemas`.
66
+ * It represents all the registered schemas' UID as a union type.
67
+ *
68
+ * @example
69
+ *
70
+ * declare global {
71
+ * namespace Strapi {
72
+ * interface Schemas {
73
+ * 'api::foo.foo': CollectionTypeSchema;
74
+ * 'api::bar.bar': ComponentSchema;
75
+ * }
76
+ * }
77
+ * }
78
+ *
79
+ * type X = SchemaUID;
80
+ * // 'api::foo.foo' | 'api::bar.bar'
81
+ */
82
+ export type SchemaUID = keyof Strapi.Schemas;
83
+
84
+ /**
85
+ * Get the type of a specific key `U` in `T`
86
+ *
87
+ * @example
88
+ *
89
+ * type X = Get<{ foo: 'bar', 'bar': 'foo' }, 'foo'>
90
+ * // 'bar'
91
+ *
92
+ * type X = Get<{ foo: 'bar', 'bar': 'foo' }, 'bar'>
93
+ * // 'foo'
94
+ */
95
+ export type Get<T, U extends keyof T> = T[U];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.3.0-beta.1",
3
+ "version": "4.3.0-beta.2",
4
4
  "description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
5
5
  "keywords": [
6
6
  "strapi",
@@ -80,17 +80,17 @@
80
80
  "dependencies": {
81
81
  "@koa/cors": "3.1.0",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.3.0-beta.1",
84
- "@strapi/database": "4.3.0-beta.1",
85
- "@strapi/generate-new": "4.3.0-beta.1",
86
- "@strapi/generators": "4.3.0-beta.1",
87
- "@strapi/logger": "4.3.0-beta.1",
88
- "@strapi/plugin-content-manager": "4.3.0-beta.1",
89
- "@strapi/plugin-content-type-builder": "4.3.0-beta.1",
90
- "@strapi/plugin-email": "4.3.0-beta.1",
91
- "@strapi/plugin-upload": "4.3.0-beta.1",
92
- "@strapi/typescript-utils": "4.3.0-beta.1",
93
- "@strapi/utils": "4.3.0-beta.1",
83
+ "@strapi/admin": "4.3.0-beta.2",
84
+ "@strapi/database": "4.3.0-beta.2",
85
+ "@strapi/generate-new": "4.3.0-beta.2",
86
+ "@strapi/generators": "4.3.0-beta.2",
87
+ "@strapi/logger": "4.3.0-beta.2",
88
+ "@strapi/plugin-content-manager": "4.3.0-beta.2",
89
+ "@strapi/plugin-content-type-builder": "4.3.0-beta.2",
90
+ "@strapi/plugin-email": "4.3.0-beta.2",
91
+ "@strapi/plugin-upload": "4.3.0-beta.2",
92
+ "@strapi/typescript-utils": "4.3.0-beta.2",
93
+ "@strapi/utils": "4.3.0-beta.2",
94
94
  "bcryptjs": "2.4.3",
95
95
  "boxen": "5.1.2",
96
96
  "chalk": "4.1.2",
@@ -105,8 +105,8 @@
105
105
  "execa": "5.1.1",
106
106
  "fs-extra": "10.0.0",
107
107
  "glob": "7.2.0",
108
- "http-errors": "1.8.0",
109
- "inquirer": "8.2.0",
108
+ "http-errors": "1.8.1",
109
+ "inquirer": "8.2.4",
110
110
  "is-docker": "2.2.1",
111
111
  "koa": "2.13.3",
112
112
  "koa-body": "4.2.0",
@@ -122,12 +122,12 @@
122
122
  "node-fetch": "2.6.7",
123
123
  "node-machine-id": "1.1.12",
124
124
  "node-schedule": "2.0.0",
125
- "open": "8.2.1",
125
+ "open": "8.4.0",
126
126
  "ora": "5.4.1",
127
127
  "package-json": "7.0.0",
128
128
  "qs": "6.10.1",
129
129
  "resolve-cwd": "3.0.0",
130
- "semver": "7.3.5",
130
+ "semver": "7.3.7",
131
131
  "statuses": "2.0.1",
132
132
  "uuid": "^3.3.2"
133
133
  },
@@ -139,5 +139,5 @@
139
139
  "node": ">=14.19.1 <=16.x.x",
140
140
  "npm": ">=6.0.0"
141
141
  },
142
- "gitHead": "9d6555398960c39159d66bb4eea3bcb0362e37e3"
142
+ "gitHead": "42aba356ad1b0751584d3b375e83baa4a2c18f65"
143
143
  }