silgi 0.0.9 → 0.0.11
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/chunks/generate.mjs +23 -18
- package/dist/cli/index.mjs +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/plugins/openapi.d.mts +1 -1
- package/dist/plugins/openapi.d.ts +1 -1
- package/dist/plugins/scalar.d.mts +1 -1
- package/dist/plugins/scalar.d.ts +1 -1
- package/dist/shared/{silgi.BmG_a4Ft.d.mts → silgi.D5qK9QOm.d.mts} +1 -0
- package/dist/shared/{silgi.BmG_a4Ft.d.ts → silgi.D5qK9QOm.d.ts} +1 -0
- package/package.json +5 -5
package/dist/chunks/generate.mjs
CHANGED
|
@@ -68,8 +68,12 @@ async function generateClientGenTS(storage, outputDir) {
|
|
|
68
68
|
}
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
|
-
const content =
|
|
72
|
-
|
|
71
|
+
const content = `// THIS FILE IS GENERATED, DO NOT EDIT!
|
|
72
|
+
/* tslint:disable */
|
|
73
|
+
/* eslint-disable */
|
|
74
|
+
/* prettier-ignore */
|
|
75
|
+
/* silgi - productdevbook.com */
|
|
76
|
+
import type { ResultOf, VariablesOf } from 'gql.tada'
|
|
73
77
|
${imports.join("\n")}
|
|
74
78
|
|
|
75
79
|
export interface SilgiClientStore {
|
|
@@ -169,7 +173,7 @@ class TypescriptGenerator {
|
|
|
169
173
|
const name = pascalCase(`${scope}_${schema.serviceName}SilgiZodSchemaType`);
|
|
170
174
|
zodInterfacesImports.push(`import type { SilgiZodSchema as ${name} } from '${schema.path}'`);
|
|
171
175
|
shareds.push({
|
|
172
|
-
type: "
|
|
176
|
+
type: "interface",
|
|
173
177
|
from: "zod",
|
|
174
178
|
key: schema.serviceName,
|
|
175
179
|
value: name
|
|
@@ -195,7 +199,7 @@ class TypescriptGenerator {
|
|
|
195
199
|
const name = pascalCase(`${scope}_${schema.serviceName}SilgiServiceType`);
|
|
196
200
|
importsString.push(`import type { SilgiService as ${name} } from '${schema.path}'`);
|
|
197
201
|
services.push({
|
|
198
|
-
type: "
|
|
202
|
+
type: "interface",
|
|
199
203
|
from: "service",
|
|
200
204
|
key: schema.serviceName,
|
|
201
205
|
value: name
|
|
@@ -215,7 +219,7 @@ class TypescriptGenerator {
|
|
|
215
219
|
const name = pascalCase(`${scope}_${uniqueIdentifier}SilgiContextType`);
|
|
216
220
|
importsString.push(`import type { SilgiContext as ${name} } from '${schema.path}'`);
|
|
217
221
|
context.push({
|
|
218
|
-
type: "
|
|
222
|
+
type: "interface",
|
|
219
223
|
from: "context",
|
|
220
224
|
key: scope,
|
|
221
225
|
value: name,
|
|
@@ -244,7 +248,7 @@ class TypescriptGenerator {
|
|
|
244
248
|
const name = pascalCase(`${scope}_${schema.serviceName}SilgiGlobalSharedType`);
|
|
245
249
|
importsString.push(`import type { SilgiGlobalShared as ${name} } from '${schema.path}'`);
|
|
246
250
|
shareds.push({
|
|
247
|
-
type: "
|
|
251
|
+
type: "interface",
|
|
248
252
|
from: "shared",
|
|
249
253
|
key: schema.serviceName,
|
|
250
254
|
value: name,
|
|
@@ -266,8 +270,8 @@ class TypescriptGenerator {
|
|
|
266
270
|
const services = [];
|
|
267
271
|
const modules = [];
|
|
268
272
|
const moduleConfig = [];
|
|
269
|
-
if (moduleData.methodsConfig
|
|
270
|
-
if (moduleData.methodsConfig.silgiMethodConfig?.length > 0) {
|
|
273
|
+
if (moduleData.methodsConfig) {
|
|
274
|
+
if (moduleData.methodsConfig.silgiMethodConfig && moduleData.methodsConfig.silgiMethodConfig?.length > 0) {
|
|
271
275
|
moduleData.methodsConfig.silgiMethodConfig.forEach((schema) => {
|
|
272
276
|
const name = camelCase(`${module}_${schema.serviceName}silgiMethodConfig`);
|
|
273
277
|
importsString.push(`import { silgiMethodConfig as ${name} } from '${schema.path}'`);
|
|
@@ -284,7 +288,7 @@ class TypescriptGenerator {
|
|
|
284
288
|
const name = pascalCase(`${module}_${schema.serviceName}SilgiMethodConfigType`);
|
|
285
289
|
importsString.push(`import type { SilgiMethodConfig as ${name} } from '${schema.path}'`);
|
|
286
290
|
methodsConfig.push({
|
|
287
|
-
type: "
|
|
291
|
+
type: "interface",
|
|
288
292
|
from: "methodsConfig",
|
|
289
293
|
key: schema.serviceName,
|
|
290
294
|
value: name
|
|
@@ -305,7 +309,7 @@ class TypescriptGenerator {
|
|
|
305
309
|
const name = pascalCase(`${module}_${uniqueIdentifier}SilgiContextType`);
|
|
306
310
|
importsString.push(`import type { SilgiContext as ${name} } from '${schema.path}'`);
|
|
307
311
|
context.push({
|
|
308
|
-
type: "
|
|
312
|
+
type: "interface",
|
|
309
313
|
from: "context",
|
|
310
314
|
key: module,
|
|
311
315
|
value: name
|
|
@@ -343,7 +347,7 @@ class TypescriptGenerator {
|
|
|
343
347
|
const name = pascalCase(`${module}_${schema.serviceName}SilgiServiceType`);
|
|
344
348
|
importsString.push(`import type { SilgiService as ${name} } from '${schema.path}'`);
|
|
345
349
|
services.push({
|
|
346
|
-
type: "
|
|
350
|
+
type: "interface",
|
|
347
351
|
from: "service",
|
|
348
352
|
key: schema.serviceName,
|
|
349
353
|
value: name
|
|
@@ -365,7 +369,7 @@ class TypescriptGenerator {
|
|
|
365
369
|
const name = pascalCase(`${module}_${schema.serviceName}SilgiModuleConfigType`);
|
|
366
370
|
importsString.push(`import type { SilgiModuleConfig as ${name} } from '${schema.path}'`);
|
|
367
371
|
moduleConfig.push({
|
|
368
|
-
type: "
|
|
372
|
+
type: "interface",
|
|
369
373
|
from: "moduleConfig",
|
|
370
374
|
key: schema.serviceName,
|
|
371
375
|
value: name
|
|
@@ -406,7 +410,7 @@ declare module 'silgi' {
|
|
|
406
410
|
${scopeDatas.some((scope) => scope.services.length > 0) ? `scopes: {
|
|
407
411
|
${scopeDatas.filter((scope) => scope.services.length > 0).map((scopeData) => {
|
|
408
412
|
const services = scopeData.services.map((shared) => {
|
|
409
|
-
if (shared.type === "
|
|
413
|
+
if (shared.type === "interface") {
|
|
410
414
|
return `${shared.key}: ${shared.value}`;
|
|
411
415
|
}
|
|
412
416
|
}).filter(Boolean).join("\n");
|
|
@@ -419,7 +423,7 @@ declare module 'silgi' {
|
|
|
419
423
|
${scopeDatas.some((scope) => scope.shareds.length > 0) ? `shared: {
|
|
420
424
|
${scopeDatas.map((scopeData) => {
|
|
421
425
|
const zodShared = scopeData.shareds.filter((shared) => shared.from === "zod").map((shared) => {
|
|
422
|
-
if (shared.type === "
|
|
426
|
+
if (shared.type === "interface") {
|
|
423
427
|
return `${shared.key}: ${shared.value}`;
|
|
424
428
|
}
|
|
425
429
|
}).filter(Boolean).join("\n");
|
|
@@ -435,7 +439,7 @@ declare module 'silgi' {
|
|
|
435
439
|
${modulesData.some((module) => module.methodsConfig.length > 0) ? `plugins: {
|
|
436
440
|
${modulesData.map((moduleData) => {
|
|
437
441
|
const methodsConfig = moduleData.methodsConfig.map((shared) => {
|
|
438
|
-
if (shared.type === "
|
|
442
|
+
if (shared.type === "interface") {
|
|
439
443
|
return `${shared.value}`;
|
|
440
444
|
}
|
|
441
445
|
}).filter(Boolean).join("\n");
|
|
@@ -446,7 +450,7 @@ declare module 'silgi' {
|
|
|
446
450
|
|
|
447
451
|
type ExtendDefaultContext = ${[...scopeDatas, ...modulesData].some((item) => item.context?.length > 0) ? [...scopeDatas, ...modulesData].filter((item) => item.context?.length > 0).map((item) => {
|
|
448
452
|
return item.context.map((shared) => {
|
|
449
|
-
if (shared.type === "
|
|
453
|
+
if (shared.type === "interface") {
|
|
450
454
|
return shared.value;
|
|
451
455
|
}
|
|
452
456
|
}).filter(Boolean).join(" & ");
|
|
@@ -649,7 +653,7 @@ class SchemaManager {
|
|
|
649
653
|
const { exportVariables } = this.parser.parseExports(content, filePath);
|
|
650
654
|
const { serviceName } = extractNamesFromPath(filePath);
|
|
651
655
|
const absoluteFilePath = resolve(this.config.rootDir, filePath);
|
|
652
|
-
let relativePath = makeRelativePath(this.config._silgi.
|
|
656
|
+
let relativePath = makeRelativePath(this.config._silgi.outputDirClientTS, absoluteFilePath);
|
|
653
657
|
relativePath = cleanPath(relativePath, this.config.removeExtensions);
|
|
654
658
|
if (!this.clientSchemas[serviceName]) {
|
|
655
659
|
this.clientSchemas[serviceName] = {
|
|
@@ -732,6 +736,7 @@ class SchemaManager {
|
|
|
732
736
|
const absoluteFilePath = resolve(config.rootDir, filePath);
|
|
733
737
|
let relativePath = makeRelativePath(config._silgi.outputDirTS, absoluteFilePath);
|
|
734
738
|
relativePath = cleanPath(relativePath, config.removeExtensions);
|
|
739
|
+
consola.log("\u{1F4C1} Scanning module:", relativePath);
|
|
735
740
|
if (stats.isDirectory()) {
|
|
736
741
|
await scan(filePath);
|
|
737
742
|
} else if (file.endsWith(".ts")) {
|
|
@@ -809,7 +814,7 @@ class SchemaManager {
|
|
|
809
814
|
});
|
|
810
815
|
}
|
|
811
816
|
}
|
|
812
|
-
consola.log("\u{1F4C1} Scanning module:", this.
|
|
817
|
+
consola.log("\u{1F4C1} Scanning module:", Object.keys(this.modulesSchema).length);
|
|
813
818
|
}
|
|
814
819
|
}
|
|
815
820
|
} catch (error) {
|
package/dist/cli/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import consola from 'consola';
|
|
|
3
3
|
|
|
4
4
|
const name = "silgi";
|
|
5
5
|
const type = "module";
|
|
6
|
-
const version = "0.0.
|
|
6
|
+
const version = "0.0.11";
|
|
7
7
|
const exports = {
|
|
8
8
|
".": {
|
|
9
9
|
"import": {
|
|
@@ -59,7 +59,7 @@ const dependencies = {
|
|
|
59
59
|
"@oxc-parser/wasm": "^0.44.0",
|
|
60
60
|
c12: "^2.0.1",
|
|
61
61
|
citty: "^0.1.6",
|
|
62
|
-
consola: "^3.3.
|
|
62
|
+
consola: "^3.3.3",
|
|
63
63
|
defu: "^6.1.4",
|
|
64
64
|
eslint: "^9.17.0",
|
|
65
65
|
h3: "^1.13.0",
|
|
@@ -67,14 +67,14 @@ const dependencies = {
|
|
|
67
67
|
jiti: "^2.4.2",
|
|
68
68
|
mlly: "^1.7.3",
|
|
69
69
|
"openapi3-ts": "^4.4.0",
|
|
70
|
-
pathe: "^
|
|
70
|
+
pathe: "^2.0.0",
|
|
71
71
|
scule: "^1.3.0",
|
|
72
72
|
unctx: "^2.4.1",
|
|
73
73
|
zod: "^3.24.1"
|
|
74
74
|
};
|
|
75
75
|
const devDependencies = {
|
|
76
76
|
silgi: "workspace:*",
|
|
77
|
-
unbuild: "^3.0
|
|
77
|
+
unbuild: "^3.2.0"
|
|
78
78
|
};
|
|
79
79
|
const resolutions = {
|
|
80
80
|
silgi: "workspace:*"
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DefaultContext, a as DefaultInterface, E as ExtractScope, S as ServicePluginConfig, b as ServiceMethod, c as ExtractShared, C as CacheScope, d as CacheKeyGenerator, M as MethodPluginConfig, e as ServiceExecutor, O as OmitSilgiOptions, I as InitSilgi, P as PergelPlugin, f as Silgi } from './shared/silgi.
|
|
2
|
-
export { h as DefaultHooks, g as InitializedCreateScope, k as SchemaGenerated, i as SilgiDefaultContext, j as SilgiDefaultInterface } from './shared/silgi.
|
|
1
|
+
import { D as DefaultContext, a as DefaultInterface, E as ExtractScope, S as ServicePluginConfig, b as ServiceMethod, c as ExtractShared, C as CacheScope, d as CacheKeyGenerator, M as MethodPluginConfig, e as ServiceExecutor, O as OmitSilgiOptions, I as InitSilgi, P as PergelPlugin, f as Silgi } from './shared/silgi.D5qK9QOm.mjs';
|
|
2
|
+
export { h as DefaultHooks, g as InitializedCreateScope, k as SchemaGenerated, i as SilgiDefaultContext, j as SilgiDefaultInterface } from './shared/silgi.D5qK9QOm.mjs';
|
|
3
3
|
import * as unctx from 'unctx';
|
|
4
4
|
import 'consola';
|
|
5
5
|
import 'h3';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DefaultContext, a as DefaultInterface, E as ExtractScope, S as ServicePluginConfig, b as ServiceMethod, c as ExtractShared, C as CacheScope, d as CacheKeyGenerator, M as MethodPluginConfig, e as ServiceExecutor, O as OmitSilgiOptions, I as InitSilgi, P as PergelPlugin, f as Silgi } from './shared/silgi.
|
|
2
|
-
export { h as DefaultHooks, g as InitializedCreateScope, k as SchemaGenerated, i as SilgiDefaultContext, j as SilgiDefaultInterface } from './shared/silgi.
|
|
1
|
+
import { D as DefaultContext, a as DefaultInterface, E as ExtractScope, S as ServicePluginConfig, b as ServiceMethod, c as ExtractShared, C as CacheScope, d as CacheKeyGenerator, M as MethodPluginConfig, e as ServiceExecutor, O as OmitSilgiOptions, I as InitSilgi, P as PergelPlugin, f as Silgi } from './shared/silgi.D5qK9QOm.js';
|
|
2
|
+
export { h as DefaultHooks, g as InitializedCreateScope, k as SchemaGenerated, i as SilgiDefaultContext, j as SilgiDefaultInterface } from './shared/silgi.D5qK9QOm.js';
|
|
3
3
|
import * as unctx from 'unctx';
|
|
4
4
|
import 'consola';
|
|
5
5
|
import 'h3';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
2
|
import { SchemaObject, ServerObject, OpenAPIObject } from 'openapi3-ts/oas31';
|
|
3
|
-
import { P as PergelPlugin, D as DefaultContext, a as DefaultInterface, I as InitSilgi } from '../shared/silgi.
|
|
3
|
+
import { P as PergelPlugin, D as DefaultContext, a as DefaultInterface, I as InitSilgi } from '../shared/silgi.D5qK9QOm.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import 'consola';
|
|
6
6
|
import 'h3';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
2
|
import { SchemaObject, ServerObject, OpenAPIObject } from 'openapi3-ts/oas31';
|
|
3
|
-
import { P as PergelPlugin, D as DefaultContext, a as DefaultInterface, I as InitSilgi } from '../shared/silgi.
|
|
3
|
+
import { P as PergelPlugin, D as DefaultContext, a as DefaultInterface, I as InitSilgi } from '../shared/silgi.D5qK9QOm.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import 'consola';
|
|
6
6
|
import 'h3';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PergelPlugin, D as DefaultContext, a as DefaultInterface } from '../shared/silgi.
|
|
1
|
+
import { P as PergelPlugin, D as DefaultContext, a as DefaultInterface } from '../shared/silgi.D5qK9QOm.mjs';
|
|
2
2
|
import 'consola';
|
|
3
3
|
import 'h3';
|
|
4
4
|
import 'zod';
|
package/dist/plugins/scalar.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ interface PergelPlugin<TContext extends DefaultContext = DefaultContext, TInterf
|
|
|
45
45
|
shared?: boolean;
|
|
46
46
|
services?: boolean;
|
|
47
47
|
methodConfig?: boolean;
|
|
48
|
+
moduleConfig?: boolean;
|
|
48
49
|
};
|
|
49
50
|
readonly priority?: PluginPriority;
|
|
50
51
|
readonly dependencies?: ReadonlyArray<keyof ExtractPluginConfig<TInterface>>;
|
|
@@ -45,6 +45,7 @@ interface PergelPlugin<TContext extends DefaultContext = DefaultContext, TInterf
|
|
|
45
45
|
shared?: boolean;
|
|
46
46
|
services?: boolean;
|
|
47
47
|
methodConfig?: boolean;
|
|
48
|
+
moduleConfig?: boolean;
|
|
48
49
|
};
|
|
49
50
|
readonly priority?: PluginPriority;
|
|
50
51
|
readonly dependencies?: ReadonlyArray<keyof ExtractPluginConfig<TInterface>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silgi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"import": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@oxc-parser/wasm": "^0.44.0",
|
|
52
52
|
"c12": "^2.0.1",
|
|
53
53
|
"citty": "^0.1.6",
|
|
54
|
-
"consola": "^3.3.
|
|
54
|
+
"consola": "^3.3.3",
|
|
55
55
|
"defu": "^6.1.4",
|
|
56
56
|
"eslint": "^9.17.0",
|
|
57
57
|
"h3": "^1.13.0",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"jiti": "^2.4.2",
|
|
60
60
|
"mlly": "^1.7.3",
|
|
61
61
|
"openapi3-ts": "^4.4.0",
|
|
62
|
-
"pathe": "^
|
|
62
|
+
"pathe": "^2.0.0",
|
|
63
63
|
"scule": "^1.3.0",
|
|
64
64
|
"unctx": "^2.4.1",
|
|
65
65
|
"zod": "^3.24.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"unbuild": "^3.0
|
|
69
|
-
"silgi": "0.0.
|
|
68
|
+
"unbuild": "^3.2.0",
|
|
69
|
+
"silgi": "0.0.11"
|
|
70
70
|
},
|
|
71
71
|
"resolutions": {
|
|
72
72
|
"silgi": "workspace:*"
|