strapi-typed-client 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/cli/commands/check.d.ts +27 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +91 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +28 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +129 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +21 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +113 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/index.d.ts +14 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +40 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/api-client.d.ts +41 -0
- package/dist/cli/utils/api-client.d.ts.map +1 -0
- package/dist/cli/utils/api-client.js +81 -0
- package/dist/cli/utils/api-client.js.map +1 -0
- package/dist/cli/utils/file-writer.d.ts +44 -0
- package/dist/cli/utils/file-writer.d.ts.map +1 -0
- package/dist/cli/utils/file-writer.js +89 -0
- package/dist/cli/utils/file-writer.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +37 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +622 -0
- package/dist/client.js +688 -0
- package/dist/core/endpoint-converter.d.ts +26 -0
- package/dist/core/endpoint-converter.d.ts.map +1 -0
- package/dist/core/endpoint-converter.js +161 -0
- package/dist/core/endpoint-converter.js.map +1 -0
- package/dist/core/generator/filters-generator.d.ts +22 -0
- package/dist/core/generator/filters-generator.d.ts.map +1 -0
- package/dist/core/generator/filters-generator.js +236 -0
- package/dist/core/generator/filters-generator.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +11 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/schema-transformer.d.ts +19 -0
- package/dist/core/schema-transformer.d.ts.map +1 -0
- package/dist/core/schema-transformer.js +306 -0
- package/dist/core/schema-transformer.js.map +1 -0
- package/dist/generator/auth-api-generator.d.ts +14 -0
- package/dist/generator/auth-api-generator.d.ts.map +1 -0
- package/dist/generator/auth-api-generator.js +518 -0
- package/dist/generator/auth-api-generator.js.map +1 -0
- package/dist/generator/blocks-types-template.d.ts +134 -0
- package/dist/generator/blocks-types-template.d.ts.map +1 -0
- package/dist/generator/blocks-types-template.js +4 -0
- package/dist/generator/blocks-types-template.js.map +1 -0
- package/dist/generator/client-generator.d.ts +19 -0
- package/dist/generator/client-generator.d.ts.map +1 -0
- package/dist/generator/client-generator.js +707 -0
- package/dist/generator/client-generator.js.map +1 -0
- package/dist/generator/custom-api-generator.d.ts +26 -0
- package/dist/generator/custom-api-generator.d.ts.map +1 -0
- package/dist/generator/custom-api-generator.js +145 -0
- package/dist/generator/custom-api-generator.js.map +1 -0
- package/dist/generator/index-generator.d.ts +4 -0
- package/dist/generator/index-generator.d.ts.map +1 -0
- package/dist/generator/index-generator.js +11 -0
- package/dist/generator/index-generator.js.map +1 -0
- package/dist/generator/index.d.ts +14 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +94 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/types-generator.d.ts +35 -0
- package/dist/generator/types-generator.d.ts.map +1 -0
- package/dist/generator/types-generator.js +641 -0
- package/dist/generator/types-generator.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/next/index.d.ts +16 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +224 -0
- package/dist/next/index.js.map +1 -0
- package/dist/parser/custom-types-parser.d.ts +39 -0
- package/dist/parser/custom-types-parser.d.ts.map +1 -0
- package/dist/parser/custom-types-parser.js +206 -0
- package/dist/parser/custom-types-parser.js.map +1 -0
- package/dist/parser/index.d.ts +23 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +457 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/routes-parser.d.ts +21 -0
- package/dist/parser/routes-parser.d.ts.map +1 -0
- package/dist/parser/routes-parser.js +184 -0
- package/dist/parser/routes-parser.js.map +1 -0
- package/dist/plugin/admin/src/index.d.ts +16 -0
- package/dist/plugin/admin/src/index.d.ts.map +1 -0
- package/dist/plugin/admin/src/index.js +30 -0
- package/dist/plugin/admin/src/index.js.map +1 -0
- package/dist/plugin/admin/src/pages/HomePage.d.ts +2 -0
- package/dist/plugin/admin/src/pages/HomePage.d.ts.map +1 -0
- package/dist/plugin/admin/src/pages/HomePage.js +273 -0
- package/dist/plugin/admin/src/pages/HomePage.js.map +1 -0
- package/dist/plugin/admin/src/pluginId.d.ts +2 -0
- package/dist/plugin/admin/src/pluginId.d.ts.map +1 -0
- package/dist/plugin/admin/src/pluginId.js +2 -0
- package/dist/plugin/admin/src/pluginId.js.map +1 -0
- package/dist/plugin/index.d.ts +22 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +22 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/server/src/config/index.d.ts +31 -0
- package/dist/plugin/server/src/config/index.d.ts.map +1 -0
- package/dist/plugin/server/src/config/index.js +35 -0
- package/dist/plugin/server/src/config/index.js.map +1 -0
- package/dist/plugin/server/src/controllers/schema.d.ts +41 -0
- package/dist/plugin/server/src/controllers/schema.d.ts.map +1 -0
- package/dist/plugin/server/src/controllers/schema.js +51 -0
- package/dist/plugin/server/src/controllers/schema.js.map +1 -0
- package/dist/plugin/server/src/index.d.ts +114 -0
- package/dist/plugin/server/src/index.d.ts.map +1 -0
- package/dist/plugin/server/src/index.js +76 -0
- package/dist/plugin/server/src/index.js.map +1 -0
- package/dist/plugin/server/src/routes/index.d.ts +14 -0
- package/dist/plugin/server/src/routes/index.d.ts.map +1 -0
- package/dist/plugin/server/src/routes/index.js +23 -0
- package/dist/plugin/server/src/routes/index.js.map +1 -0
- package/dist/plugin/server/src/services/endpoints.d.ts +36 -0
- package/dist/plugin/server/src/services/endpoints.d.ts.map +1 -0
- package/dist/plugin/server/src/services/endpoints.js +523 -0
- package/dist/plugin/server/src/services/endpoints.js.map +1 -0
- package/dist/plugin/server/src/services/schema.d.ts +25 -0
- package/dist/plugin/server/src/services/schema.d.ts.map +1 -0
- package/dist/plugin/server/src/services/schema.js +164 -0
- package/dist/plugin/server/src/services/schema.js.map +1 -0
- package/dist/schema-meta.ts +7 -0
- package/dist/schema-types.d.ts +104 -0
- package/dist/schema-types.d.ts.map +1 -0
- package/dist/schema-types.js +3 -0
- package/dist/schema-types.js.map +1 -0
- package/dist/shared/constants.d.ts +99 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +89 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/endpoint-types.d.ts +42 -0
- package/dist/shared/endpoint-types.d.ts.map +1 -0
- package/dist/shared/endpoint-types.js +6 -0
- package/dist/shared/endpoint-types.js.map +1 -0
- package/dist/shared/index.d.ts +12 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +13 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/naming-utils.d.ts +55 -0
- package/dist/shared/naming-utils.d.ts.map +1 -0
- package/dist/shared/naming-utils.js +106 -0
- package/dist/shared/naming-utils.js.map +1 -0
- package/dist/shared/schema-hash.d.ts +39 -0
- package/dist/shared/schema-hash.d.ts.map +1 -0
- package/dist/shared/schema-hash.js +67 -0
- package/dist/shared/schema-hash.js.map +1 -0
- package/dist/shared/strapi-schema-types.d.ts +77 -0
- package/dist/shared/strapi-schema-types.d.ts.map +1 -0
- package/dist/shared/strapi-schema-types.js +10 -0
- package/dist/shared/strapi-schema-types.js.map +1 -0
- package/dist/shared/string-utils.d.ts +68 -0
- package/dist/shared/string-utils.d.ts.map +1 -0
- package/dist/shared/string-utils.js +124 -0
- package/dist/shared/string-utils.js.map +1 -0
- package/dist/transformer/index.d.ts +17 -0
- package/dist/transformer/index.d.ts.map +1 -0
- package/dist/transformer/index.js +83 -0
- package/dist/transformer/index.js.map +1 -0
- package/dist/types.d.ts +3430 -0
- package/dist/types.js +3 -0
- package/package.json +152 -0
- package/strapi-admin.js +2 -0
- package/strapi-server.js +2 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema service for Strapi Types Plugin
|
|
3
|
+
* Extracts schema information from Strapi and computes hashes for change detection
|
|
4
|
+
*/
|
|
5
|
+
import { computeSchemaHash } from '../../../../shared/schema-hash.js';
|
|
6
|
+
import { SYSTEM_FIELDS, PRIVATE_FIELDS } from '../../../../shared/constants.js';
|
|
7
|
+
/**
|
|
8
|
+
* Filter out system attributes that shouldn't be exposed
|
|
9
|
+
*/
|
|
10
|
+
function filterAttributes(attributes) {
|
|
11
|
+
// Combine system fields (createdAt, updatedAt — added by generator as base fields)
|
|
12
|
+
// and private fields (createdBy, updatedBy, publishedAt, locale, localizations)
|
|
13
|
+
const systemFields = [
|
|
14
|
+
...SYSTEM_FIELDS.filter(f => f !== 'id' && f !== 'documentId'),
|
|
15
|
+
...PRIVATE_FIELDS,
|
|
16
|
+
];
|
|
17
|
+
const filtered = {};
|
|
18
|
+
for (const [name, attr] of Object.entries(attributes)) {
|
|
19
|
+
// Skip system fields
|
|
20
|
+
if (systemFields.includes(name)) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
// Skip private attributes
|
|
24
|
+
if (attr.private) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// Skip admin relations
|
|
28
|
+
if (attr.type === 'relation') {
|
|
29
|
+
const target = attr.target;
|
|
30
|
+
if (target?.startsWith('admin::')) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
// Allow users-permissions relations
|
|
34
|
+
if (target?.startsWith('plugin::') &&
|
|
35
|
+
!target.includes('users-permissions')) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
filtered[name] = attr;
|
|
40
|
+
}
|
|
41
|
+
return filtered;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Extract clean content type schema
|
|
45
|
+
*/
|
|
46
|
+
function extractContentType(ct) {
|
|
47
|
+
const uid = ct.uid;
|
|
48
|
+
// Only include API content types and users-permissions
|
|
49
|
+
if (!uid.startsWith('api::') && !uid.includes('users-permissions')) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
uid,
|
|
54
|
+
kind: ct.kind || 'collectionType',
|
|
55
|
+
collectionName: ct.collectionName,
|
|
56
|
+
info: {
|
|
57
|
+
singularName: ct.info?.singularName || '',
|
|
58
|
+
pluralName: ct.info?.pluralName || '',
|
|
59
|
+
displayName: ct.info?.displayName || '',
|
|
60
|
+
description: ct.info?.description,
|
|
61
|
+
},
|
|
62
|
+
attributes: filterAttributes(ct.attributes || {}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Extract clean component schema
|
|
67
|
+
*/
|
|
68
|
+
function extractComponent(component) {
|
|
69
|
+
const uid = component.uid;
|
|
70
|
+
return {
|
|
71
|
+
uid,
|
|
72
|
+
category: component.category || uid.split('.')[0],
|
|
73
|
+
info: {
|
|
74
|
+
displayName: component.info?.displayName || '',
|
|
75
|
+
description: component.info?.description,
|
|
76
|
+
},
|
|
77
|
+
attributes: filterAttributes(component.attributes || {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export default ({ strapi }) => ({
|
|
81
|
+
/**
|
|
82
|
+
* Extract the complete schema from Strapi
|
|
83
|
+
*/
|
|
84
|
+
extractSchema() {
|
|
85
|
+
const contentTypes = {};
|
|
86
|
+
const components = {};
|
|
87
|
+
// Extract content types
|
|
88
|
+
for (const [uid, ct] of Object.entries(strapi.contentTypes)) {
|
|
89
|
+
const extracted = extractContentType(ct);
|
|
90
|
+
if (extracted) {
|
|
91
|
+
contentTypes[uid] = extracted;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Extract components
|
|
95
|
+
for (const [uid, component] of Object.entries(strapi.components)) {
|
|
96
|
+
const extracted = extractComponent(component);
|
|
97
|
+
if (extracted) {
|
|
98
|
+
components[uid] = extracted;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return { contentTypes, components };
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Get the full schema with hash and endpoints
|
|
105
|
+
*/
|
|
106
|
+
getSchema() {
|
|
107
|
+
const schema = this.extractSchema();
|
|
108
|
+
// Get endpoints from endpoints service
|
|
109
|
+
let endpoints = [];
|
|
110
|
+
let extraTypes = [];
|
|
111
|
+
try {
|
|
112
|
+
const endpointsService = strapi
|
|
113
|
+
.plugin('strapi-typed-client')
|
|
114
|
+
.service('endpoints');
|
|
115
|
+
if (endpointsService) {
|
|
116
|
+
const endpointsResult = endpointsService.extractEndpoints();
|
|
117
|
+
endpoints = endpointsResult.endpoints;
|
|
118
|
+
extraTypes = endpointsResult.extraTypes || [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Endpoints service might not be available, continue without endpoints
|
|
123
|
+
}
|
|
124
|
+
// Include endpoints and extraTypes in hash computation for complete change detection
|
|
125
|
+
const hashData = { schema, endpoints, extraTypes };
|
|
126
|
+
const hash = computeSchemaHash(hashData);
|
|
127
|
+
return {
|
|
128
|
+
schema,
|
|
129
|
+
endpoints,
|
|
130
|
+
extraTypes,
|
|
131
|
+
hash,
|
|
132
|
+
generatedAt: new Date().toISOString(),
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Get only the schema hash (lightweight operation)
|
|
137
|
+
*/
|
|
138
|
+
getSchemaHash() {
|
|
139
|
+
const schema = this.extractSchema();
|
|
140
|
+
// Include endpoints and extraTypes in hash computation for consistency with getSchema()
|
|
141
|
+
let endpoints = [];
|
|
142
|
+
let extraTypes = [];
|
|
143
|
+
try {
|
|
144
|
+
const endpointsService = strapi
|
|
145
|
+
.plugin('strapi-typed-client')
|
|
146
|
+
.service('endpoints');
|
|
147
|
+
if (endpointsService) {
|
|
148
|
+
const endpointsResult = endpointsService.extractEndpoints();
|
|
149
|
+
endpoints = endpointsResult.endpoints;
|
|
150
|
+
extraTypes = endpointsResult.extraTypes || [];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Endpoints service might not be available
|
|
155
|
+
}
|
|
156
|
+
const hashData = { schema, endpoints, extraTypes };
|
|
157
|
+
const hash = computeSchemaHash(hashData);
|
|
158
|
+
return {
|
|
159
|
+
hash,
|
|
160
|
+
generatedAt: new Date().toISOString(),
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/plugin/server/src/services/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAyB/E;;GAEG;AACH,SAAS,gBAAgB,CACrB,UAA2C;IAE3C,mFAAmF;IACnF,gFAAgF;IAChF,MAAM,YAAY,GAAa;QAC3B,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,YAAY,CAAC;QAC9D,GAAG,cAAc;KACpB,CAAA;IAED,MAAM,QAAQ,GAAoC,EAAE,CAAA;IAEpD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE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C,WAAW,CAAC,CAAA;YACzB,IAAI,gBAAgB,EAAE,CAAC;gBACnB,MAAM,eAAe,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,CAAA;gBAC3D,SAAS,GAAG,eAAe,CAAC,SAAS,CAAA;gBACrC,UAAU,GAAG,eAAe,CAAC,UAAU,IAAI,EAAE,CAAA;YACjD,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,2CAA2C;QAC/C,CAAC;QAED,MAAM,QAAQ,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;QAClD,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;QAExC,OAAO;YACH,IAAI;YACJ,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACxC,CAAA;IACL,CAAC;CACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export interface ParsedSchema {
|
|
2
|
+
contentTypes: ContentType[];
|
|
3
|
+
components: Component[];
|
|
4
|
+
}
|
|
5
|
+
export interface ContentType {
|
|
6
|
+
name: string;
|
|
7
|
+
cleanName: string;
|
|
8
|
+
collectionName: string;
|
|
9
|
+
kind: 'collection' | 'single';
|
|
10
|
+
attributes: Attribute[];
|
|
11
|
+
relations: Relation[];
|
|
12
|
+
media: MediaField[];
|
|
13
|
+
components: ComponentField[];
|
|
14
|
+
dynamicZones: DynamicZoneField[];
|
|
15
|
+
}
|
|
16
|
+
export interface Component {
|
|
17
|
+
name: string;
|
|
18
|
+
cleanName: string;
|
|
19
|
+
category: string;
|
|
20
|
+
attributes: Attribute[];
|
|
21
|
+
relations: Relation[];
|
|
22
|
+
media: MediaField[];
|
|
23
|
+
components: ComponentField[];
|
|
24
|
+
dynamicZones: DynamicZoneField[];
|
|
25
|
+
}
|
|
26
|
+
export interface Relation {
|
|
27
|
+
name: string;
|
|
28
|
+
relationType: 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany';
|
|
29
|
+
target: string;
|
|
30
|
+
targetType: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface MediaField {
|
|
34
|
+
name: string;
|
|
35
|
+
multiple: boolean;
|
|
36
|
+
required: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ComponentField {
|
|
39
|
+
name: string;
|
|
40
|
+
component: string;
|
|
41
|
+
componentType: string;
|
|
42
|
+
repeatable: boolean;
|
|
43
|
+
required: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface DynamicZoneField {
|
|
46
|
+
name: string;
|
|
47
|
+
components: string[];
|
|
48
|
+
componentTypes: string[];
|
|
49
|
+
required: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface Attribute {
|
|
52
|
+
name: string;
|
|
53
|
+
type: AttributeType;
|
|
54
|
+
required: boolean;
|
|
55
|
+
unique?: boolean;
|
|
56
|
+
defaultValue?: any;
|
|
57
|
+
}
|
|
58
|
+
export type AttributeType = {
|
|
59
|
+
kind: 'string';
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'text';
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'richtext';
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'blocks';
|
|
66
|
+
} | {
|
|
67
|
+
kind: 'email';
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'integer';
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'biginteger';
|
|
72
|
+
} | {
|
|
73
|
+
kind: 'float';
|
|
74
|
+
} | {
|
|
75
|
+
kind: 'decimal';
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'boolean';
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'date';
|
|
80
|
+
} | {
|
|
81
|
+
kind: 'datetime';
|
|
82
|
+
} | {
|
|
83
|
+
kind: 'time';
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'json';
|
|
86
|
+
} | {
|
|
87
|
+
kind: 'enumeration';
|
|
88
|
+
values: string[];
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'media';
|
|
91
|
+
multiple?: boolean;
|
|
92
|
+
} | {
|
|
93
|
+
kind: 'component';
|
|
94
|
+
component: string;
|
|
95
|
+
repeatable?: boolean;
|
|
96
|
+
} | {
|
|
97
|
+
kind: 'dynamiczone';
|
|
98
|
+
components: string[];
|
|
99
|
+
} | {
|
|
100
|
+
kind: 'relation';
|
|
101
|
+
relationType: 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany';
|
|
102
|
+
target: string;
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=schema-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-types.d.ts","sourceRoot":"","sources":["../src/schema-types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,UAAU,EAAE,SAAS,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAA;IAC7B,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,YAAY,EAAE,gBAAgB,EAAE,CAAA;CACnC;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,YAAY,EAAE,gBAAgB,EAAE,CAAA;CACnC;AAED,MAAM,WAAW,QAAQ;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I,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,GAC7C;IACI,IAAI,EAAE,UAAU,CAAA;IAChB,YAAY,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAA;IACnE,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-types.js","sourceRoot":"","sources":["../src/schema-types.ts"],"names":[],"mappings":"AAAA,yCAAyC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for Strapi Types Generator
|
|
3
|
+
* @module shared/constants
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* System fields that are automatically added to all Strapi content types
|
|
7
|
+
* These are included in output types but not in input types
|
|
8
|
+
*/
|
|
9
|
+
export declare const SYSTEM_FIELDS: readonly ["id", "documentId", "createdAt", "updatedAt"];
|
|
10
|
+
/**
|
|
11
|
+
* Private/internal Strapi fields that should be excluded from generated types
|
|
12
|
+
* These fields are managed by Strapi and not accessible via API
|
|
13
|
+
*/
|
|
14
|
+
export declare const PRIVATE_FIELDS: readonly ["createdBy", "updatedBy", "publishedAt", "locale", "localizations"];
|
|
15
|
+
/**
|
|
16
|
+
* All fields to skip when generating entity types
|
|
17
|
+
*/
|
|
18
|
+
export declare const SKIP_FIELDS: readonly ["createdBy", "updatedBy", "publishedAt", "locale", "localizations"];
|
|
19
|
+
/**
|
|
20
|
+
* Strapi filter operators
|
|
21
|
+
*/
|
|
22
|
+
export declare const FILTER_OPERATORS: {
|
|
23
|
+
readonly $eq: "Equal";
|
|
24
|
+
readonly $eqi: "Equal (case-insensitive)";
|
|
25
|
+
readonly $ne: "Not equal";
|
|
26
|
+
readonly $nei: "Not equal (case-insensitive)";
|
|
27
|
+
readonly $lt: "Less than";
|
|
28
|
+
readonly $lte: "Less than or equal";
|
|
29
|
+
readonly $gt: "Greater than";
|
|
30
|
+
readonly $gte: "Greater than or equal";
|
|
31
|
+
readonly $in: "In array";
|
|
32
|
+
readonly $notIn: "Not in array";
|
|
33
|
+
readonly $null: "Is null";
|
|
34
|
+
readonly $notNull: "Is not null";
|
|
35
|
+
readonly $between: "Between (array of [start, end])";
|
|
36
|
+
readonly $contains: "Contains substring";
|
|
37
|
+
readonly $notContains: "Does not contain substring";
|
|
38
|
+
readonly $containsi: "Contains substring (case-insensitive)";
|
|
39
|
+
readonly $notContainsi: "Does not contain substring (case-insensitive)";
|
|
40
|
+
readonly $startsWith: "Starts with";
|
|
41
|
+
readonly $startsWithi: "Starts with (case-insensitive)";
|
|
42
|
+
readonly $endsWith: "Ends with";
|
|
43
|
+
readonly $endsWithi: "Ends with (case-insensitive)";
|
|
44
|
+
readonly $and: "Logical AND";
|
|
45
|
+
readonly $or: "Logical OR";
|
|
46
|
+
readonly $not: "Logical NOT";
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Strapi relation types
|
|
50
|
+
*/
|
|
51
|
+
export declare const RELATION_TYPES: {
|
|
52
|
+
readonly oneToOne: {
|
|
53
|
+
readonly isArray: false;
|
|
54
|
+
readonly nullable: true;
|
|
55
|
+
};
|
|
56
|
+
readonly oneToMany: {
|
|
57
|
+
readonly isArray: true;
|
|
58
|
+
readonly nullable: false;
|
|
59
|
+
};
|
|
60
|
+
readonly manyToOne: {
|
|
61
|
+
readonly isArray: false;
|
|
62
|
+
readonly nullable: true;
|
|
63
|
+
};
|
|
64
|
+
readonly manyToMany: {
|
|
65
|
+
readonly isArray: true;
|
|
66
|
+
readonly nullable: false;
|
|
67
|
+
};
|
|
68
|
+
readonly morphToOne: {
|
|
69
|
+
readonly isArray: false;
|
|
70
|
+
readonly nullable: true;
|
|
71
|
+
};
|
|
72
|
+
readonly morphToMany: {
|
|
73
|
+
readonly isArray: true;
|
|
74
|
+
readonly nullable: false;
|
|
75
|
+
};
|
|
76
|
+
readonly morphOne: {
|
|
77
|
+
readonly isArray: false;
|
|
78
|
+
readonly nullable: true;
|
|
79
|
+
};
|
|
80
|
+
readonly morphMany: {
|
|
81
|
+
readonly isArray: true;
|
|
82
|
+
readonly nullable: false;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Default HTTP methods for Strapi CRUD operations
|
|
87
|
+
*/
|
|
88
|
+
export declare const CRUD_METHODS: {
|
|
89
|
+
readonly find: "GET";
|
|
90
|
+
readonly findOne: "GET";
|
|
91
|
+
readonly create: "POST";
|
|
92
|
+
readonly update: "PUT";
|
|
93
|
+
readonly delete: "DELETE";
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Package version (injected at build time or read from package.json)
|
|
97
|
+
*/
|
|
98
|
+
export declare const PACKAGE_NAME = "strapi-typed-client";
|
|
99
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,yDAKhB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,cAAc,+EAMjB,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,WAAW,+EAA+B,CAAA;AAEvD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;CA8BnB,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASjB,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;CAMf,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,YAAY,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for Strapi Types Generator
|
|
3
|
+
* @module shared/constants
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* System fields that are automatically added to all Strapi content types
|
|
7
|
+
* These are included in output types but not in input types
|
|
8
|
+
*/
|
|
9
|
+
export const SYSTEM_FIELDS = [
|
|
10
|
+
'id',
|
|
11
|
+
'documentId',
|
|
12
|
+
'createdAt',
|
|
13
|
+
'updatedAt',
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Private/internal Strapi fields that should be excluded from generated types
|
|
17
|
+
* These fields are managed by Strapi and not accessible via API
|
|
18
|
+
*/
|
|
19
|
+
export const PRIVATE_FIELDS = [
|
|
20
|
+
'createdBy',
|
|
21
|
+
'updatedBy',
|
|
22
|
+
'publishedAt',
|
|
23
|
+
'locale',
|
|
24
|
+
'localizations',
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* All fields to skip when generating entity types
|
|
28
|
+
*/
|
|
29
|
+
export const SKIP_FIELDS = [...PRIVATE_FIELDS];
|
|
30
|
+
/**
|
|
31
|
+
* Strapi filter operators
|
|
32
|
+
*/
|
|
33
|
+
export const FILTER_OPERATORS = {
|
|
34
|
+
// Comparison operators
|
|
35
|
+
$eq: 'Equal',
|
|
36
|
+
$eqi: 'Equal (case-insensitive)',
|
|
37
|
+
$ne: 'Not equal',
|
|
38
|
+
$nei: 'Not equal (case-insensitive)',
|
|
39
|
+
$lt: 'Less than',
|
|
40
|
+
$lte: 'Less than or equal',
|
|
41
|
+
$gt: 'Greater than',
|
|
42
|
+
$gte: 'Greater than or equal',
|
|
43
|
+
$in: 'In array',
|
|
44
|
+
$notIn: 'Not in array',
|
|
45
|
+
$null: 'Is null',
|
|
46
|
+
$notNull: 'Is not null',
|
|
47
|
+
$between: 'Between (array of [start, end])',
|
|
48
|
+
// String operators
|
|
49
|
+
$contains: 'Contains substring',
|
|
50
|
+
$notContains: 'Does not contain substring',
|
|
51
|
+
$containsi: 'Contains substring (case-insensitive)',
|
|
52
|
+
$notContainsi: 'Does not contain substring (case-insensitive)',
|
|
53
|
+
$startsWith: 'Starts with',
|
|
54
|
+
$startsWithi: 'Starts with (case-insensitive)',
|
|
55
|
+
$endsWith: 'Ends with',
|
|
56
|
+
$endsWithi: 'Ends with (case-insensitive)',
|
|
57
|
+
// Logical operators (for combining filters)
|
|
58
|
+
$and: 'Logical AND',
|
|
59
|
+
$or: 'Logical OR',
|
|
60
|
+
$not: 'Logical NOT',
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Strapi relation types
|
|
64
|
+
*/
|
|
65
|
+
export const RELATION_TYPES = {
|
|
66
|
+
oneToOne: { isArray: false, nullable: true },
|
|
67
|
+
oneToMany: { isArray: true, nullable: false },
|
|
68
|
+
manyToOne: { isArray: false, nullable: true },
|
|
69
|
+
manyToMany: { isArray: true, nullable: false },
|
|
70
|
+
morphToOne: { isArray: false, nullable: true },
|
|
71
|
+
morphToMany: { isArray: true, nullable: false },
|
|
72
|
+
morphOne: { isArray: false, nullable: true },
|
|
73
|
+
morphMany: { isArray: true, nullable: false },
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Default HTTP methods for Strapi CRUD operations
|
|
77
|
+
*/
|
|
78
|
+
export const CRUD_METHODS = {
|
|
79
|
+
find: 'GET',
|
|
80
|
+
findOne: 'GET',
|
|
81
|
+
create: 'POST',
|
|
82
|
+
update: 'PUT',
|
|
83
|
+
delete: 'DELETE',
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Package version (injected at build time or read from package.json)
|
|
87
|
+
*/
|
|
88
|
+
export const PACKAGE_NAME = 'strapi-typed-client';
|
|
89
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,IAAI;IACJ,YAAY;IACZ,WAAW;IACX,WAAW;CACL,CAAA;AAEV;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,WAAW;IACX,WAAW;IACX,aAAa;IACb,QAAQ;IACR,eAAe;CACT,CAAA;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,cAAc,CAAU,CAAA;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,uBAAuB;IACvB,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,0BAA0B;IAChC,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,8BAA8B;IACpC,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,cAAc;IACnB,IAAI,EAAE,uBAAuB;IAC7B,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,iCAAiC;IAE3C,mBAAmB;IACnB,SAAS,EAAE,oBAAoB;IAC/B,YAAY,EAAE,4BAA4B;IAC1C,UAAU,EAAE,uCAAuC;IACnD,aAAa,EAAE,+CAA+C;IAC9D,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,gCAAgC;IAC9C,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,8BAA8B;IAE1C,4CAA4C;IAC5C,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,aAAa;CACb,CAAA;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5C,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC7C,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC9C,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC9C,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC/C,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5C,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;CACvC,CAAA;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,QAAQ;CACV,CAAA;AAEV;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared endpoint types used by both the Strapi plugin (server) and CLI
|
|
3
|
+
* @module shared/endpoint-types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Type information for a custom endpoint (body, response, params, query)
|
|
7
|
+
*/
|
|
8
|
+
export interface EndpointType {
|
|
9
|
+
body?: string;
|
|
10
|
+
response?: string;
|
|
11
|
+
params?: string;
|
|
12
|
+
query?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A parsed endpoint from Strapi custom routes
|
|
16
|
+
*/
|
|
17
|
+
export interface ParsedEndpoint {
|
|
18
|
+
method: string;
|
|
19
|
+
path: string;
|
|
20
|
+
handler: string;
|
|
21
|
+
controller: string;
|
|
22
|
+
action: string;
|
|
23
|
+
types?: EndpointType;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Extra exported type from a controller file (not part of Endpoints interface)
|
|
27
|
+
* e.g., `export type SSEEvent = { type: 'connected' } | { type: 'progress', ... }`
|
|
28
|
+
*/
|
|
29
|
+
export interface ExtraControllerType {
|
|
30
|
+
controller: string;
|
|
31
|
+
typeName: string;
|
|
32
|
+
typeDefinition: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Response from the endpoints service
|
|
36
|
+
*/
|
|
37
|
+
export interface EndpointsResponse {
|
|
38
|
+
endpoints: ParsedEndpoint[];
|
|
39
|
+
extraTypes: ExtraControllerType[];
|
|
40
|
+
count: number;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=endpoint-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-types.d.ts","sourceRoot":"","sources":["../../src/shared/endpoint-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,YAAY,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,cAAc,EAAE,CAAA;IAC3B,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,KAAK,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-types.js","sourceRoot":"","sources":["../../src/shared/endpoint-types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for Strapi Types Generator
|
|
3
|
+
* @module shared
|
|
4
|
+
*/
|
|
5
|
+
export { toCamelCase, toLowerFirst, toPascalCase, toKebabCase, toSnakeCase, capitalize, pluralize, toPascalCasePreserve, extractPathParams, } from './string-utils.js';
|
|
6
|
+
export { convertComponentName, extractCleanName, toEndpointName, extractRelationTarget, toComponentUid, extractComponentCategory, } from './naming-utils.js';
|
|
7
|
+
export { computeSchemaHash, schemasMatch, shortHash, generateSchemaMetadata, } from './schema-hash.js';
|
|
8
|
+
export type { SchemaMetadata } from './schema-hash.js';
|
|
9
|
+
export type { EndpointType, ParsedEndpoint, ExtraControllerType, EndpointsResponse, } from './endpoint-types.js';
|
|
10
|
+
export type { StrapiAttribute, StrapiContentType, StrapiComponent, ExtractedSchema, SchemaResponse, HashResponse, } from './strapi-schema-types.js';
|
|
11
|
+
export { SYSTEM_FIELDS, PRIVATE_FIELDS, SKIP_FIELDS, FILTER_OPERATORS, RELATION_TYPES, CRUD_METHODS, PACKAGE_NAME, } from './constants.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,wBAAwB,GAC3B,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,sBAAsB,GACzB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGtD,YAAY,EACR,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,iBAAiB,GACpB,MAAM,qBAAqB,CAAA;AAG5B,YAAY,EACR,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,cAAc,EACd,YAAY,GACf,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EACH,aAAa,EACb,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,GACf,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for Strapi Types Generator
|
|
3
|
+
* @module shared
|
|
4
|
+
*/
|
|
5
|
+
// String manipulation utilities
|
|
6
|
+
export { toCamelCase, toLowerFirst, toPascalCase, toKebabCase, toSnakeCase, capitalize, pluralize, toPascalCasePreserve, extractPathParams, } from './string-utils.js';
|
|
7
|
+
// Naming conventions utilities
|
|
8
|
+
export { convertComponentName, extractCleanName, toEndpointName, extractRelationTarget, toComponentUid, extractComponentCategory, } from './naming-utils.js';
|
|
9
|
+
// Schema hashing utilities
|
|
10
|
+
export { computeSchemaHash, schemasMatch, shortHash, generateSchemaMetadata, } from './schema-hash.js';
|
|
11
|
+
// Constants
|
|
12
|
+
export { SYSTEM_FIELDS, PRIVATE_FIELDS, SKIP_FIELDS, FILTER_OPERATORS, RELATION_TYPES, CRUD_METHODS, PACKAGE_NAME, } from './constants.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gCAAgC;AAChC,OAAO,EACH,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,mBAAmB,CAAA;AAE1B,+BAA+B;AAC/B,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,wBAAwB,GAC3B,MAAM,mBAAmB,CAAA;AAE1B,2BAA2B;AAC3B,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,sBAAsB,GACzB,MAAM,kBAAkB,CAAA;AAqBzB,YAAY;AACZ,OAAO,EACH,aAAa,EACb,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,GACf,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Naming utilities for Strapi Types Generator
|
|
3
|
+
* Handles conversion of Strapi-specific naming patterns to TypeScript
|
|
4
|
+
* @module shared/naming-utils
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert Strapi component UID to TypeScript interface name
|
|
8
|
+
* @example
|
|
9
|
+
* convertComponentName('shared.feature') // 'SharedFeature'
|
|
10
|
+
* convertComponentName('landing.editor-feature') // 'LandingEditorFeature'
|
|
11
|
+
*/
|
|
12
|
+
export declare function convertComponentName(component: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Extract clean entity name from Strapi API interface name
|
|
15
|
+
* Handles both Api* and Plugin* prefixes
|
|
16
|
+
* @example
|
|
17
|
+
* extractCleanName('ApiItemItem') // 'Item'
|
|
18
|
+
* extractCleanName('ApiCategoryCategory') // 'Category'
|
|
19
|
+
* extractCleanName('PluginUsersPermissionsUser') // 'User'
|
|
20
|
+
* extractCleanName('PluginUsersPermissionsRole') // 'Role'
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractCleanName(apiName: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Convert clean entity name to API endpoint name
|
|
25
|
+
* Follows Strapi's convention of pluralized kebab-case for collections
|
|
26
|
+
* and plain kebab-case for single types
|
|
27
|
+
* @example
|
|
28
|
+
* toEndpointName('Item') // 'items'
|
|
29
|
+
* toEndpointName('SaveGame') // 'save-games'
|
|
30
|
+
* toEndpointName('Category') // 'categories'
|
|
31
|
+
* toEndpointName('Homepage', true) // 'homepage'
|
|
32
|
+
*/
|
|
33
|
+
export declare function toEndpointName(cleanName: string, isSingle?: boolean): string;
|
|
34
|
+
/**
|
|
35
|
+
* Extract Strapi relation target to TypeScript type name
|
|
36
|
+
* Handles both API and Plugin relation targets
|
|
37
|
+
* @example
|
|
38
|
+
* extractRelationTarget("'api::item.item'") // 'Item'
|
|
39
|
+
* extractRelationTarget("'plugin::users-permissions.user'") // 'User'
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractRelationTarget(target: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Convert Strapi component category and name to component UID
|
|
44
|
+
* @example
|
|
45
|
+
* toComponentUid('Landing', 'EditorFeature') // 'landing.editor-feature'
|
|
46
|
+
*/
|
|
47
|
+
export declare function toComponentUid(category: string, name: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Extract component category from component name
|
|
50
|
+
* @example
|
|
51
|
+
* extractComponentCategory('landing.editor-feature') // 'landing'
|
|
52
|
+
* extractComponentCategory('shared.seo') // 'shared'
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractComponentCategory(componentUid: string): string;
|
|
55
|
+
//# sourceMappingURL=naming-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming-utils.d.ts","sourceRoot":"","sources":["../../src/shared/naming-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuBxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAG5E;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqB5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAGrE"}
|