strapi-typed-client 1.2.2 → 1.2.3
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/dist/cli/commands/generate.js +1 -1
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +0 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/endpoint-converter.d.ts +2 -2
- package/dist/core/endpoint-converter.d.ts.map +1 -1
- package/dist/generator/auth-api-generator.d.ts +1 -1
- package/dist/generator/auth-api-generator.d.ts.map +1 -1
- package/dist/generator/auth-api-generator.js +2 -3
- package/dist/generator/auth-api-generator.js.map +1 -1
- package/dist/generator/client-generator.d.ts +1 -3
- package/dist/generator/client-generator.d.ts.map +1 -1
- package/dist/generator/client-generator.js +1 -17
- package/dist/generator/client-generator.js.map +1 -1
- package/dist/generator/custom-api-generator.d.ts +2 -2
- package/dist/generator/custom-api-generator.d.ts.map +1 -1
- package/dist/generator/index.d.ts +1 -2
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +2 -4
- package/dist/generator/index.js.map +1 -1
- package/dist/shared/custom-types.d.ts +17 -0
- package/dist/shared/custom-types.d.ts.map +1 -0
- package/dist/shared/custom-types.js +2 -0
- package/dist/shared/custom-types.js.map +1 -0
- package/dist/{parser/routes-parser.d.ts → shared/route-types.d.ts} +1 -9
- package/dist/shared/route-types.d.ts.map +1 -0
- package/dist/shared/route-types.js +2 -0
- package/dist/shared/route-types.js.map +1 -0
- package/package.json +1 -1
- package/dist/parser/custom-types-parser.d.ts +0 -39
- package/dist/parser/custom-types-parser.d.ts.map +0 -1
- package/dist/parser/custom-types-parser.js +0 -206
- package/dist/parser/custom-types-parser.js.map +0 -1
- package/dist/parser/index.d.ts +0 -23
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -462
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/routes-parser.d.ts.map +0 -1
- package/dist/parser/routes-parser.js +0 -216
- package/dist/parser/routes-parser.js.map +0 -1
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { toLowerFirst, toPascalCase } from '../shared/index.js';
|
|
5
|
-
export class CustomTypesParser {
|
|
6
|
-
/**
|
|
7
|
-
* Parse API namespace files from api/ directory
|
|
8
|
-
*/
|
|
9
|
-
parse(inputDir) {
|
|
10
|
-
const result = {
|
|
11
|
-
types: new Map(),
|
|
12
|
-
typeDefinitions: [],
|
|
13
|
-
namespaceImports: [],
|
|
14
|
-
};
|
|
15
|
-
const apiDir = path.join(inputDir, 'api');
|
|
16
|
-
if (!fs.existsSync(apiDir)) {
|
|
17
|
-
console.log('⚠️ API types directory not found, using default types (any)');
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
console.log(' Found API types directory, parsing namespaces...');
|
|
21
|
-
// Parse all TypeScript files in api/ directory
|
|
22
|
-
const files = fs
|
|
23
|
-
.readdirSync(apiDir)
|
|
24
|
-
.filter(f => f.endsWith('.ts') && f !== 'index.ts');
|
|
25
|
-
const namespaces = [];
|
|
26
|
-
for (const file of files) {
|
|
27
|
-
const filePath = path.join(apiDir, file);
|
|
28
|
-
const parsedNamespaces = this.parseNamespaceFile(filePath);
|
|
29
|
-
namespaces.push(...parsedNamespaces);
|
|
30
|
-
}
|
|
31
|
-
// Convert namespaces to handler mappings
|
|
32
|
-
for (const ns of namespaces) {
|
|
33
|
-
// Add namespace to imports
|
|
34
|
-
result.namespaceImports.push(ns.name);
|
|
35
|
-
// Add namespace declaration to type definitions
|
|
36
|
-
result.typeDefinitions.push(ns.fullText);
|
|
37
|
-
// Create handler mappings for each action
|
|
38
|
-
for (const [action, types] of ns.types) {
|
|
39
|
-
// Try multiple handler variations
|
|
40
|
-
const handlers = this.generateHandlerVariations(ns.controller, action);
|
|
41
|
-
for (const handler of handlers) {
|
|
42
|
-
result.types.set(handler, {
|
|
43
|
-
handler,
|
|
44
|
-
inputType: types.request
|
|
45
|
-
? `${ns.name}.${types.request}`
|
|
46
|
-
: undefined,
|
|
47
|
-
outputType: types.response
|
|
48
|
-
? `${ns.name}.${types.response}`
|
|
49
|
-
: undefined,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
console.log(` Loaded ${result.types.size} custom endpoint type definitions from ${namespaces.length} namespaces`);
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Parse a single API namespace file
|
|
59
|
-
*/
|
|
60
|
-
parseNamespaceFile(filePath) {
|
|
61
|
-
const sourceCode = fs.readFileSync(filePath, 'utf-8');
|
|
62
|
-
const sourceFile = ts.createSourceFile(filePath, sourceCode, ts.ScriptTarget.Latest, true);
|
|
63
|
-
const namespaces = [];
|
|
64
|
-
const visit = (node) => {
|
|
65
|
-
// Look for: export namespace SomethingAPI { ... }
|
|
66
|
-
if (ts.isModuleDeclaration(node) &&
|
|
67
|
-
node.name &&
|
|
68
|
-
ts.isIdentifier(node.name) &&
|
|
69
|
-
node.name.text.endsWith('API')) {
|
|
70
|
-
const namespaceName = node.name.text;
|
|
71
|
-
const controller = this.namespaceToController(namespaceName);
|
|
72
|
-
const fullText = node.getText(sourceFile);
|
|
73
|
-
const types = new Map();
|
|
74
|
-
// Parse interfaces inside the namespace
|
|
75
|
-
if (node.body && ts.isModuleBlock(node.body)) {
|
|
76
|
-
for (const statement of node.body.statements) {
|
|
77
|
-
if (ts.isInterfaceDeclaration(statement)) {
|
|
78
|
-
const interfaceName = statement.name.text;
|
|
79
|
-
// Determine action name and type based on suffix
|
|
80
|
-
// Supported patterns:
|
|
81
|
-
// - SomethingRequest / SomethingResponse
|
|
82
|
-
// - SomethingFormData (treated as Request, for multipart/form-data endpoints)
|
|
83
|
-
// - SomethingEvent (treated as Request)
|
|
84
|
-
// - SomethingInput / SomethingOutput
|
|
85
|
-
if (interfaceName.endsWith('Request')) {
|
|
86
|
-
const action = interfaceName.replace(/Request$/, '');
|
|
87
|
-
const existing = types.get(action) || {};
|
|
88
|
-
types.set(action, {
|
|
89
|
-
...existing,
|
|
90
|
-
request: interfaceName,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
else if (interfaceName.endsWith('Response')) {
|
|
94
|
-
const action = interfaceName.replace(/Response$/, '');
|
|
95
|
-
const existing = types.get(action) || {};
|
|
96
|
-
types.set(action, {
|
|
97
|
-
...existing,
|
|
98
|
-
response: interfaceName,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
else if (interfaceName.endsWith('FormData')) {
|
|
102
|
-
// Treat FormData as Request (for multipart/form-data endpoints)
|
|
103
|
-
const action = interfaceName.replace(/FormData$/, '');
|
|
104
|
-
const existing = types.get(action) || {};
|
|
105
|
-
types.set(action, {
|
|
106
|
-
...existing,
|
|
107
|
-
request: interfaceName,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
else if (interfaceName.endsWith('Event')) {
|
|
111
|
-
// Treat Event as Request (for webhooks)
|
|
112
|
-
const action = interfaceName.replace(/Event$/, '');
|
|
113
|
-
const existing = types.get(action) || {};
|
|
114
|
-
types.set(action, {
|
|
115
|
-
...existing,
|
|
116
|
-
request: interfaceName,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
else if (interfaceName.endsWith('Input')) {
|
|
120
|
-
const action = interfaceName.replace(/Input$/, '');
|
|
121
|
-
const existing = types.get(action) || {};
|
|
122
|
-
types.set(action, {
|
|
123
|
-
...existing,
|
|
124
|
-
request: interfaceName,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
else if (interfaceName.endsWith('Output')) {
|
|
128
|
-
const action = interfaceName.replace(/Output$/, '');
|
|
129
|
-
const existing = types.get(action) || {};
|
|
130
|
-
types.set(action, {
|
|
131
|
-
...existing,
|
|
132
|
-
response: interfaceName,
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
namespaces.push({
|
|
139
|
-
name: namespaceName,
|
|
140
|
-
controller,
|
|
141
|
-
types,
|
|
142
|
-
fullText,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
ts.forEachChild(node, visit);
|
|
146
|
-
};
|
|
147
|
-
visit(sourceFile);
|
|
148
|
-
return namespaces;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Convert namespace name to controller name
|
|
152
|
-
* e.g., 'TeamInvitationAPI' -> 'team-invitation'
|
|
153
|
-
* e.g., 'AIStudioAPI' -> 'ai-studio'
|
|
154
|
-
*/
|
|
155
|
-
namespaceToController(namespaceName) {
|
|
156
|
-
// Remove 'API' suffix
|
|
157
|
-
const withoutSuffix = namespaceName.replace(/API$/, '');
|
|
158
|
-
// Convert PascalCase to kebab-case
|
|
159
|
-
// Special handling for consecutive uppercase letters (acronyms)
|
|
160
|
-
return (withoutSuffix
|
|
161
|
-
// First, handle sequences of uppercase letters followed by lowercase (e.g., "AIStudio" -> "AI-Studio")
|
|
162
|
-
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
|
|
163
|
-
// Then handle normal PascalCase transitions (e.g., "TeamInvitation" -> "Team-Invitation")
|
|
164
|
-
.replace(/([a-z\d])([A-Z])/g, '$1-$2')
|
|
165
|
-
.toLowerCase());
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Generate handler variations for flexible matching
|
|
169
|
-
* e.g., controller='checkout', action='CreateCheckout' -> ['checkout.createCheckout', 'checkout.create']
|
|
170
|
-
* e.g., controller='webhook', action='StripeWebhook' -> ['webhook.stripeWebhook', 'webhook.stripe']
|
|
171
|
-
*/
|
|
172
|
-
generateHandlerVariations(controller, action) {
|
|
173
|
-
const handlers = [];
|
|
174
|
-
const controllerPascal = toPascalCase(controller);
|
|
175
|
-
// 1. Direct mapping: action as-is (camelCase)
|
|
176
|
-
handlers.push(`${controller}.${toLowerFirst(action)}`);
|
|
177
|
-
// 2. Remove controller name from action if it's present
|
|
178
|
-
// e.g., 'CreateCheckout' with controller 'checkout' -> 'create'
|
|
179
|
-
if (action.includes(controllerPascal)) {
|
|
180
|
-
const actionWithoutController = action.replace(controllerPascal, '');
|
|
181
|
-
if (actionWithoutController) {
|
|
182
|
-
handlers.push(`${controller}.${toLowerFirst(actionWithoutController)}`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// 3. Remove 'Webhook' suffix for webhook handlers
|
|
186
|
-
// e.g., 'StripeWebhook' -> 'stripe', 'YooKassaWebhook' -> 'yooKassa'
|
|
187
|
-
if (action.includes('Webhook')) {
|
|
188
|
-
const actionWithoutWebhook = action.replace('Webhook', '');
|
|
189
|
-
if (actionWithoutWebhook && actionWithoutWebhook !== action) {
|
|
190
|
-
handlers.push(`${controller}.${toLowerFirst(actionWithoutWebhook)}`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
// 4. Remove other common suffixes
|
|
194
|
-
const commonSuffixes = ['Subscription', 'Member', 'Invitation'];
|
|
195
|
-
for (const suffix of commonSuffixes) {
|
|
196
|
-
if (action.includes(suffix)) {
|
|
197
|
-
const actionWithoutSuffix = action.replace(suffix, '');
|
|
198
|
-
if (actionWithoutSuffix && actionWithoutSuffix !== action) {
|
|
199
|
-
handlers.push(`${controller}.${toLowerFirst(actionWithoutSuffix)}`);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return handlers;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=custom-types-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom-types-parser.js","sourceRoot":"","sources":["../../src/parser/custom-types-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAA;AAChC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAC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AC,EAAE,CACvD,CAAA;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAA;IACnB,CAAC;CACJ"}
|
package/dist/parser/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ParsedSchema } from '../schema-types.js';
|
|
2
|
-
export declare class StrapiTypeParser {
|
|
3
|
-
private inputDir;
|
|
4
|
-
constructor(inputDir: string);
|
|
5
|
-
parse(): ParsedSchema;
|
|
6
|
-
private parseContentTypes;
|
|
7
|
-
private parseComponents;
|
|
8
|
-
private parseContentType;
|
|
9
|
-
private parseComponent;
|
|
10
|
-
private parseAttributeOrRelation;
|
|
11
|
-
private parseAttributeType;
|
|
12
|
-
private isPrivateAttribute;
|
|
13
|
-
private isRequiredAttribute;
|
|
14
|
-
private extractStringLiteral;
|
|
15
|
-
private extractEnumValues;
|
|
16
|
-
private extractRelationInfo;
|
|
17
|
-
private extractComponentInfo;
|
|
18
|
-
private extractDynamicZoneInfo;
|
|
19
|
-
private extractCleanName;
|
|
20
|
-
private extractComponentCategory;
|
|
21
|
-
private extractTargetTypeName;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,YAAY,EAKf,MAAM,oBAAoB,CAAA;AAI3B,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAQ;gBAEZ,QAAQ,EAAE,MAAM;IAI5B,KAAK,IAAI,YAAY;IAUrB,OAAO,CAAC,iBAAiB;IAqCzB,OAAO,CAAC,eAAe;IA6BvB,OAAO,CAAC,gBAAgB;IAiFxB,OAAO,CAAC,cAAc;IAqDtB,OAAO,CAAC,wBAAwB;IAwHhC,OAAO,CAAC,kBAAkB;IAyE1B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,sBAAsB;IAoB9B,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,qBAAqB;CAyBhC"}
|