mirror of
https://github.com/strapi/strapi.git
synced 2025-11-09 22:59:14 +00:00
Fix type only pkg being required as js
This commit is contained in:
parent
13af230903
commit
5da4345568
@ -1,9 +1,10 @@
|
|||||||
const { createCoreController } = require('@strapi/strapi').factories;
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
|
||||||
module.exports = createCoreController('api::address.address', {
|
module.exports = createCoreController('api::address.address', {
|
||||||
async find(ctx) {
|
async find(ctx) {
|
||||||
const { results } = await strapi.service('api::address.address').find();
|
const { results } = await strapi.service('api::address.address').find();
|
||||||
|
|
||||||
ctx.body = await this.sanitizeOutput(results);
|
ctx.body = await this.sanitizeOutput(results, ctx);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
154
examples/getstarted/types/generated/components.d.ts
vendored
Normal file
154
examples/getstarted/types/generated/components.d.ts
vendored
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
import type { Schema, Attribute } from '@strapi/strapi';
|
||||||
|
|
||||||
|
export interface BasicRelation extends Schema.Component {
|
||||||
|
collectionName: 'components_basic_relations';
|
||||||
|
info: {
|
||||||
|
displayName: 'Relation';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
categories: Attribute.Relation<'basic.relation', 'oneToMany', 'api::category.category'>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BasicSimple extends Schema.Component {
|
||||||
|
collectionName: 'components_basic_simples';
|
||||||
|
info: {
|
||||||
|
displayName: 'simple';
|
||||||
|
icon: 'ambulance';
|
||||||
|
description: '';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String & Attribute.Required;
|
||||||
|
test: Attribute.String;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BlogTestComo extends Schema.Component {
|
||||||
|
collectionName: 'components_blog_test_comos';
|
||||||
|
info: {
|
||||||
|
displayName: 'test comp';
|
||||||
|
icon: 'air-freshener';
|
||||||
|
description: '';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String & Attribute.DefaultTo<'toto'>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultApple extends Schema.Component {
|
||||||
|
collectionName: 'components_default_apples';
|
||||||
|
info: {
|
||||||
|
displayName: 'apple';
|
||||||
|
icon: 'apple-alt';
|
||||||
|
description: '';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String & Attribute.Required;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultCar extends Schema.Component {
|
||||||
|
collectionName: 'components_default_cars';
|
||||||
|
info: {
|
||||||
|
displayName: 'car';
|
||||||
|
icon: 'align-right';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultClosingperiod extends Schema.Component {
|
||||||
|
collectionName: 'components_closingperiods';
|
||||||
|
info: {
|
||||||
|
displayName: 'closingperiod';
|
||||||
|
description: '';
|
||||||
|
icon: 'angry';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
label: Attribute.String & Attribute.DefaultTo<'toto'>;
|
||||||
|
start_date: Attribute.Date & Attribute.Required;
|
||||||
|
end_date: Attribute.Date & Attribute.Required;
|
||||||
|
media: Attribute.Media;
|
||||||
|
dish: Attribute.Component<'default.dish', true> &
|
||||||
|
Attribute.Required &
|
||||||
|
Attribute.SetMinMax<{
|
||||||
|
min: 2;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultDish extends Schema.Component {
|
||||||
|
collectionName: 'components_dishes';
|
||||||
|
info: {
|
||||||
|
displayName: 'dish';
|
||||||
|
description: '';
|
||||||
|
icon: 'address-book';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String & Attribute.DefaultTo<'My super dish'>;
|
||||||
|
description: Attribute.Text;
|
||||||
|
price: Attribute.Float;
|
||||||
|
picture: Attribute.Media;
|
||||||
|
very_long_description: Attribute.RichText;
|
||||||
|
categories: Attribute.Relation<'default.dish', 'oneToOne', 'api::category.category'>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultOpeningtimes extends Schema.Component {
|
||||||
|
collectionName: 'components_openingtimes';
|
||||||
|
info: {
|
||||||
|
displayName: 'openingtimes';
|
||||||
|
description: '';
|
||||||
|
icon: 'calendar';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
label: Attribute.String & Attribute.Required & Attribute.DefaultTo<'something'>;
|
||||||
|
time: Attribute.String;
|
||||||
|
dishrep: Attribute.Component<'default.dish', true>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultRestaurantservice extends Schema.Component {
|
||||||
|
collectionName: 'components_restaurantservices';
|
||||||
|
info: {
|
||||||
|
displayName: 'restaurantservice';
|
||||||
|
description: '';
|
||||||
|
icon: 'cannabis';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String & Attribute.Required & Attribute.DefaultTo<'something'>;
|
||||||
|
media: Attribute.Media;
|
||||||
|
is_available: Attribute.Boolean & Attribute.Required & Attribute.DefaultTo<true>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultTemp extends Schema.Component {
|
||||||
|
collectionName: 'components_default_temps';
|
||||||
|
info: {
|
||||||
|
displayName: 'temp';
|
||||||
|
icon: 'adjust';
|
||||||
|
description: '';
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
name: Attribute.String & Attribute.Required;
|
||||||
|
url: Attribute.String;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@strapi/strapi' {
|
||||||
|
export module Shared {
|
||||||
|
export interface Components {
|
||||||
|
'basic.relation': BasicRelation;
|
||||||
|
'basic.simple': BasicSimple;
|
||||||
|
'blog.test-como': BlogTestComo;
|
||||||
|
'default.apple': DefaultApple;
|
||||||
|
'default.car': DefaultCar;
|
||||||
|
'default.closingperiod': DefaultClosingperiod;
|
||||||
|
'default.dish': DefaultDish;
|
||||||
|
'default.openingtimes': DefaultOpeningtimes;
|
||||||
|
'default.restaurantservice': DefaultRestaurantservice;
|
||||||
|
'default.temp': DefaultTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1311
examples/getstarted/types/generated/contentTypes.d.ts
vendored
Normal file
1311
examples/getstarted/types/generated/contentTypes.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
|||||||
import '@strapi/typings';
|
|
||||||
import strapiFactory from './Strapi';
|
import strapiFactory from './Strapi';
|
||||||
|
|
||||||
export type * from '@strapi/typings';
|
export type * from '@strapi/typings';
|
||||||
|
|||||||
@ -2,3 +2,4 @@ node_modules/
|
|||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
dist/
|
dist/
|
||||||
jest.config.js
|
jest.config.js
|
||||||
|
index.js
|
||||||
|
|||||||
2
packages/core/typings/index.js
Normal file
2
packages/core/typings/index.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// this is a failsafe file in case the package gets required as code
|
||||||
|
module.exports = null;
|
||||||
@ -26,10 +26,11 @@
|
|||||||
"url": "https://strapi.io"
|
"url": "https://strapi.io"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"main": "./dist/index.js",
|
"main": "index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"./dist"
|
"./dist",
|
||||||
|
"index.js"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run -T tsc -p tsconfig.build.json",
|
"build": "run -T tsc -p tsconfig.build.json",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user