silgi 0.5.0 → 0.6.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.
@@ -1,6 +1,6 @@
1
1
  const name = "silgi";
2
2
  const type = "module";
3
- const version = "0.5.0";
3
+ const version = "0.6.0";
4
4
  const packageManager = "pnpm@9.15.1";
5
5
  const sideEffects = false;
6
6
  const exports = {
@@ -93,6 +93,18 @@ async function nitroFramework(silgi, skip = false) {
93
93
  packageImport: "silgi/runtime/internal/nitro",
94
94
  path: join(runtimeDir, "internal/nitro")
95
95
  });
96
+ silgi.hook("prepare:core.ts", (data) => {
97
+ data.importItems["nitropack/runtime"] ??= {
98
+ import: [],
99
+ from: "nitropack/runtime"
100
+ };
101
+ data.importItems["nitropack/runtime"].import.push(
102
+ { name: "useStorage" }
103
+ );
104
+ data._silgiConfigs.push({
105
+ storage: `useStorage()`
106
+ });
107
+ });
96
108
  await h3Framework(silgi, true);
97
109
  }
98
110
 
@@ -112,12 +124,39 @@ async function prepareDir(dir) {
112
124
  await fsp.mkdir(dir, { recursive: true });
113
125
  }
114
126
 
127
+ function myBabelPlugin() {
128
+ return {
129
+ visitor: {
130
+ CallExpression(path) {
131
+ const callee = path.get("callee");
132
+ if (callee.isMemberExpression() && callee.get("object").isIdentifier({ name: "console" }) && callee.get("property").isIdentifier({ name: "log" })) {
133
+ callee.get("property").replaceWithSourceString("warn");
134
+ }
135
+ },
136
+ StringLiteral(path) {
137
+ if (path.node.value === "nitropack/runtime") {
138
+ path.replaceWithSourceString("'silgi/runtime'");
139
+ }
140
+ }
141
+ }
142
+ };
143
+ }
115
144
  async function readCoreFile(silgi) {
116
145
  const path = resolve(silgi.options.silgi.serverDir, "core.ts");
117
146
  const jiti = createJiti(silgi.options.rootDir, {
118
147
  fsCache: false,
119
148
  interopDefault: true,
120
149
  moduleCache: false,
150
+ transformOptions: {
151
+ babel: {
152
+ plugins: [myBabelPlugin()]
153
+ }
154
+ },
155
+ // debug: true,
156
+ // transform(opts) {
157
+ // console.log(opts)
158
+ // return babelTransform(opts)
159
+ // },
121
160
  alias: silgi.options.alias
122
161
  });
123
162
  const resolvedPath = jiti.esmResolve(path);
@@ -188,16 +227,19 @@ function scanActionModulesUris(silgi, obj, currentPath = []) {
188
227
  if (path.length === 4) {
189
228
  const basePath = path.join("/");
190
229
  let moduleName = "";
191
- if (node.modules?.graphqlyoga) {
230
+ if (node.modules?.yoga) {
192
231
  let rootFieldName = null;
193
- if (node.modules?.graphqlyoga?.rootFieldName) {
194
- moduleName = "graphqlyoga";
195
- rootFieldName = node.modules?.graphqlyoga?.rootFieldName;
232
+ if (node.modules?.yoga?.rootFieldName) {
233
+ moduleName = "yoga";
234
+ rootFieldName = node.modules?.yoga?.rootFieldName;
196
235
  }
197
236
  if (!rootFieldName) {
198
237
  return;
199
238
  }
200
239
  uriMap[moduleName] ??= {};
240
+ if (uriMap[moduleName].rootFieldName) {
241
+ silgi.logger.withTag("scanActionModulesUris").error(`Hata ${moduleName} ${rootFieldName} ${basePath} bu zaten burada kullanilmis.`);
242
+ }
201
243
  uriMap[moduleName].rootFieldName ??= {};
202
244
  uriMap[moduleName].rootFieldName[rootFieldName] = basePath;
203
245
  }
@@ -360,7 +402,7 @@ async function createCoreFramework(silgi) {
360
402
  functions
361
403
  });
362
404
  const content = [
363
- ...functions.map((f) => ` await ${f}(framework)`)
405
+ ...functions.map((f) => f.params?.length ? ` await ${f.name}(framework, ${f.params.join(",")})` : ` await ${f.name}(framework)`)
364
406
  ];
365
407
  return {
366
408
  content,
@@ -535,7 +577,8 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
535
577
  import: [
536
578
  { name: "SilgiModuleOptions", type: true },
537
579
  { name: "SilgiOptions", type: true },
538
- { name: "FrameworkContext", type: true }
580
+ { name: "FrameworkContext", type: true },
581
+ { name: "DeepPartial", type: true }
539
582
  ],
540
583
  from: "silgi/types"
541
584
  }
@@ -559,6 +602,13 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
559
602
  const shareds = [];
560
603
  const schemas = [];
561
604
  const buildSilgiExtraContent = [];
605
+ const _silgiOptions = {};
606
+ const _silgiConfigs = [];
607
+ for (const module of silgi.scanModules) {
608
+ _silgiOptions[module.meta.configKey] = {
609
+ ...module.options
610
+ };
611
+ }
562
612
  await silgi.callHook("prepare:core.ts", {
563
613
  importItems,
564
614
  customImports,
@@ -566,7 +616,9 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
566
616
  services,
567
617
  shareds,
568
618
  schemas,
569
- buildSilgiExtraContent
619
+ buildSilgiExtraContent,
620
+ _silgiOptions,
621
+ _silgiConfigs
570
622
  });
571
623
  if (services.length > 0) {
572
624
  importItems["silgi/core"].import.push({ name: "mergeServices" });
@@ -613,9 +665,9 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
613
665
  }),
614
666
  shareds.length > 0 ? "])" : "}",
615
667
  "",
668
+ `export const _silgiOptions: DeepPartial<SilgiModuleOptions> = ${JSON.stringify(_silgiOptions, null, 2)}`,
616
669
  "",
617
670
  "export async function buildSilgi(framework: FrameworkContext, options?: Partial<SilgiModuleOptions>) {",
618
- " try {",
619
671
  " const silgi = await createSilgi({",
620
672
  " framework,",
621
673
  " shared: shareds as any,",
@@ -624,9 +676,10 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
624
676
  " uris,",
625
677
  " modulesURIs,",
626
678
  ` plugins: [${plugins.join(", ")}],`,
627
- "",
679
+ _silgiConfigs.length > 0 ? ` ${_silgiConfigs.map((config) => Object.entries(config).map(([key, value]) => `${key}: ${value}`)).join(",\n ")},` : "",
628
680
  " options: {",
629
681
  ` present: '${silgi.options.preset}',`,
682
+ " ..._silgiOptions,",
630
683
  " ...options,",
631
684
  " },",
632
685
  " })",
@@ -636,9 +689,6 @@ async function silgiCoreFile(data, frameworkContext, silgi) {
636
689
  ...buildSilgiExtraContent,
637
690
  "",
638
691
  " return silgi",
639
- " } catch (error) {",
640
- " throw new Error(error.message)",
641
- " }",
642
692
  "}",
643
693
  ""
644
694
  ];
@@ -994,7 +1044,8 @@ async function _resolveSilgiModule(mod, silgi) {
994
1044
  silgi.scanModules.push({
995
1045
  meta: buildTimeModuleMeta,
996
1046
  entryPath: _url,
997
- installed: false
1047
+ installed: false,
1048
+ options: await mod.getOptions?.() || {}
998
1049
  });
999
1050
  }
1000
1051
  }
@@ -1339,8 +1390,11 @@ async function createSilgiCLI(config = {}, opts = {}) {
1339
1390
  }
1340
1391
  await scanAndSyncOptions(silgi);
1341
1392
  await scanModules$1(silgi);
1342
- await scanFiles$1(silgi);
1343
- await graphqlLoadSync(silgi);
1393
+ try {
1394
+ await scanFiles$1(silgi);
1395
+ await graphqlLoadSync(silgi);
1396
+ } catch {
1397
+ }
1344
1398
  silgi.storage = await createStorageCLI(silgi);
1345
1399
  silgi.hooks.hook("close", async () => {
1346
1400
  await silgi.storage.dispose();
@@ -1,7 +1,7 @@
1
1
  import { SilgiCLIConfig, LoadConfigOptions, SilgiCLIOptions, SilgiCLI, SilgiConfig, Silgi, SilgiRouterTypes, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiModuleShared, SilgiEvent, DefaultNamespaces, BaseSchemaType } from 'silgi/types';
2
2
  import { TSConfig } from 'pkg-types';
3
3
  import { FetchOptions } from 'ofetch';
4
- export { c as createStorage, s as silgi } from '../shared/silgi.DGmIWx95.mjs';
4
+ export { c as createStorage, s as silgi, u as useStorage } from '../shared/silgi.DRWtysQv.mjs';
5
5
  import { StandardSchemaV1 } from '@standard-schema/spec';
6
6
  import 'unstorage';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { SilgiCLIConfig, LoadConfigOptions, SilgiCLIOptions, SilgiCLI, SilgiConfig, Silgi, SilgiRouterTypes, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiModuleShared, SilgiEvent, DefaultNamespaces, BaseSchemaType } from 'silgi/types';
2
2
  import { TSConfig } from 'pkg-types';
3
3
  import { FetchOptions } from 'ofetch';
4
- export { c as createStorage, s as silgi } from '../shared/silgi.DGmIWx95.js';
4
+ export { c as createStorage, s as silgi, u as useStorage } from '../shared/silgi.DRWtysQv.js';
5
5
  import { StandardSchemaV1 } from '@standard-schema/spec';
6
6
  import 'unstorage';
7
7
 
@@ -1049,18 +1049,14 @@ function parseURI(uri, uris) {
1049
1049
  throw ErrorFactory.create({
1050
1050
  message: "URI cannot be empty",
1051
1051
  httpStatus: HttpStatus.BAD_REQUEST,
1052
- context: {
1053
- uri
1054
- }
1052
+ context: { uri }
1055
1053
  });
1056
1054
  }
1057
1055
  if (!uris) {
1058
1056
  throw ErrorFactory.create({
1059
1057
  message: "URIs configuration is not provided",
1060
1058
  httpStatus: HttpStatus.INTERNAL_SERVER_ERROR,
1061
- context: {
1062
- uri
1063
- }
1059
+ context: { uri }
1064
1060
  });
1065
1061
  }
1066
1062
  const cleanUri = uri.replace(/^\/*(srn\/)?/, "").replace(/\/*$/, "");
@@ -1070,29 +1066,19 @@ function parseURI(uri, uris) {
1070
1066
  queryString.split("&").map((param) => param.split("="))
1071
1067
  ) : undefined;
1072
1068
  const method = query?.method ? query?.method.toLowerCase() : undefined;
1073
- if (method && parts.length < 3 || !method && parts.length < 4) {
1074
- throw ErrorFactory.create({
1075
- message: "Invalid URI format: Insufficient path segments",
1076
- httpStatus: HttpStatus.BAD_REQUEST,
1077
- context: {
1078
- uri,
1079
- cleanUri,
1080
- partsLength: parts.length,
1081
- method,
1082
- expectedMinLength: method ? 3 : 4
1083
- }
1084
- });
1085
- }
1086
1069
  const namespaceName = parts[0];
1087
1070
  const serviceName = parts[1];
1088
1071
  const methodName = method || parts[2];
1089
1072
  const actionName = method ? parts[2] : parts[3];
1090
1073
  if (!namespaceName || !serviceName || !methodName || !actionName) {
1091
1074
  throw ErrorFactory.create({
1092
- message: "Invalid URI format: Missing required path segments",
1075
+ message: "Invalid URI format: Insufficient path segments",
1093
1076
  httpStatus: HttpStatus.BAD_REQUEST,
1094
1077
  context: {
1095
1078
  uri,
1079
+ cleanUri,
1080
+ partsLength: parts.length,
1081
+ method,
1096
1082
  namespaceName,
1097
1083
  serviceName,
1098
1084
  methodName,
@@ -1100,24 +1086,14 @@ function parseURI(uri, uris) {
1100
1086
  }
1101
1087
  });
1102
1088
  }
1103
- const hasParameters = parts.length > 4;
1104
1089
  const baseUri = `${namespaceName}/${serviceName}/${methodName}/${actionName}`;
1090
+ const paramStartIndex = method ? 3 : 4;
1091
+ const parameters = parts.slice(paramStartIndex);
1092
+ const normalizedUri = method ? `${namespaceName}/${serviceName}/${method}/${actionName}${parameters.length ? `/${parameters.join("/")}` : ""}` : cleanUri;
1105
1093
  const template = uris[baseUri];
1106
- if (template === "") {
1107
- if (hasParameters) {
1108
- throw ErrorFactory.create({
1109
- message: "Parameters are not allowed for this route",
1110
- httpStatus: HttpStatus.BAD_REQUEST,
1111
- context: {
1112
- uri,
1113
- baseUri,
1114
- extraParams: parts.slice(4)
1115
- }
1116
- });
1117
- }
1118
- } else if (!template) {
1094
+ if (template === undefined) {
1119
1095
  throw ErrorFactory.create({
1120
- message: "Route not found",
1096
+ message: "No route found for URI",
1121
1097
  httpStatus: HttpStatus.NOT_FOUND,
1122
1098
  context: {
1123
1099
  uri,
@@ -1125,59 +1101,69 @@ function parseURI(uri, uris) {
1125
1101
  }
1126
1102
  });
1127
1103
  }
1128
- const routeTemplate = typeof template === "string" ? template : template.pattern;
1129
- const validators = typeof template === "string" ? undefined : template.validators;
1130
- const routerParams = {};
1131
- if (routeTemplate === "") {
1132
- if (parts.length > 4) {
1104
+ if (template === "") {
1105
+ if (parameters.length > 0) {
1133
1106
  throw ErrorFactory.create({
1134
- message: "Parameters are not allowed for this route",
1107
+ message: "No parameters expected for this route",
1135
1108
  httpStatus: HttpStatus.BAD_REQUEST,
1136
1109
  context: {
1137
1110
  uri,
1138
1111
  baseUri,
1139
- extraParams: parts.slice(4)
1112
+ extraParams: parameters
1140
1113
  }
1141
1114
  });
1142
1115
  }
1143
- } else {
1144
- const templateParts = routeTemplate.split("/").filter(Boolean);
1145
- const paramValues = parts.slice(4);
1146
- let valueIndex = 0;
1147
- templateParts.forEach((part) => {
1148
- if (part.startsWith(":")) {
1149
- const paramName = part.substring(1);
1150
- const paramValue = paramValues[valueIndex];
1151
- if (validators?.[paramName] && paramValue) {
1152
- if (!validators[paramName](paramValue)) {
1153
- throw ErrorFactory.create({
1154
- message: `Invalid parameter value: ${paramName}`,
1155
- httpStatus: HttpStatus.UNPROCESSABLE_ENTITY,
1156
- context: {
1157
- uri,
1158
- paramName,
1159
- paramValue,
1160
- validatorName: paramName
1161
- }
1162
- });
1163
- }
1116
+ return {
1117
+ namespaceName,
1118
+ serviceName,
1119
+ methodName,
1120
+ actionName,
1121
+ raw: normalizedUri,
1122
+ parts: [namespaceName, serviceName, methodName, actionName],
1123
+ routerParams: {},
1124
+ query: method ? undefined : query,
1125
+ uri: baseUri
1126
+ };
1127
+ }
1128
+ const routeTemplate = typeof template === "string" ? template : template.pattern;
1129
+ const validators = typeof template === "string" ? undefined : template.validators;
1130
+ const routerParams = {};
1131
+ const templateParts = routeTemplate.split("/").filter(Boolean);
1132
+ const paramValues = parameters;
1133
+ let valueIndex = 0;
1134
+ templateParts.forEach((part) => {
1135
+ if (part.startsWith(":")) {
1136
+ const paramName = part.substring(1);
1137
+ const paramValue = paramValues[valueIndex];
1138
+ if (validators?.[paramName] && paramValue) {
1139
+ if (!validators[paramName](paramValue)) {
1140
+ throw ErrorFactory.create({
1141
+ message: "Invalid value for parameter",
1142
+ httpStatus: HttpStatus.UNPROCESSABLE_ENTITY,
1143
+ context: {
1144
+ uri,
1145
+ paramName,
1146
+ paramValue,
1147
+ validatorName: paramName
1148
+ }
1149
+ });
1164
1150
  }
1165
- routerParams[paramName] = paramValue || undefined;
1166
- valueIndex++;
1167
- } else if (part && part === paramValues[valueIndex]) {
1168
- valueIndex++;
1169
1151
  }
1170
- });
1171
- }
1152
+ routerParams[paramName] = paramValue || undefined;
1153
+ valueIndex++;
1154
+ } else if (part && part === paramValues[valueIndex]) {
1155
+ valueIndex++;
1156
+ }
1157
+ });
1172
1158
  return {
1173
1159
  namespaceName,
1174
1160
  serviceName,
1175
1161
  methodName,
1176
1162
  actionName,
1177
- raw: cleanUri,
1163
+ raw: normalizedUri,
1178
1164
  parts: [namespaceName, serviceName, methodName, actionName],
1179
1165
  routerParams,
1180
- query,
1166
+ query: method ? undefined : query,
1181
1167
  uri: baseUri
1182
1168
  };
1183
1169
  }
@@ -1289,14 +1275,14 @@ async function createSilgi(config) {
1289
1275
  await applyDefaults(SilgiConfigSchema, config.options);
1290
1276
  const silgi = {
1291
1277
  schemas: config.schemas,
1292
- services: config.services,
1293
- shared: config.shared,
1294
- uris: config.uris,
1295
- modulesURIs: config.modulesURIs,
1278
+ services: config.services ?? {},
1279
+ shared: config.shared ?? undefined,
1280
+ uris: config.uris ?? {},
1281
+ modulesURIs: config.modulesURIs ?? {},
1296
1282
  scannedHandlers: /* @__PURE__ */ new Map(),
1297
1283
  plugins: config.plugins ?? [],
1298
- framework: config.framework,
1299
- storage: undefined,
1284
+ framework: config.framework ?? undefined,
1285
+ storage: config.storage ?? undefined,
1300
1286
  options: config.options,
1301
1287
  hooks,
1302
1288
  callHook: hooks.callHook,
@@ -1326,7 +1312,9 @@ async function createSilgi(config) {
1326
1312
  };
1327
1313
  await runSilgiPlugins(silgi);
1328
1314
  await scanAction(silgi);
1329
- silgi.storage = await createStorage(silgi);
1315
+ if (!silgi.storage) {
1316
+ silgi.storage = await createStorage(silgi);
1317
+ }
1330
1318
  silgi.shared.storage = (...data) => {
1331
1319
  return useStorage(...data);
1332
1320
  };
@@ -1659,4 +1647,4 @@ function createShared(shared) {
1659
1647
  return shared;
1660
1648
  }
1661
1649
 
1662
- export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SchemaParser, SilgiError, createSchema, createService, createShared, createSilgi, createSilgiFetch, createStorage, getEvent, isBaseError, loadOptions, mergeSchemas, mergeServices, mergeShared, parseURI, silgi, silgiGenerateType, useSilgi };
1650
+ export { ErrorCategory, ErrorFactory, ErrorSeverity, HttpStatus, SchemaParser, SilgiError, createSchema, createService, createShared, createSilgi, createSilgiFetch, createStorage, getEvent, isBaseError, loadOptions, mergeSchemas, mergeServices, mergeShared, parseURI, silgi, silgiGenerateType, useSilgi, useStorage };
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import { GraphQLSchema } from 'graphql';
3
3
  import { SilgiCLI, GraphQLJSON, SilgiPreset, SilgiPresetMeta } from 'silgi/types';
4
- import { M as ModuleOptions, a as ModuleDefinition, S as SilgiModule } from '../shared/silgi.CN_giHTc.mjs';
4
+ import { M as ModuleOptions, a as ModuleDefinition, S as SilgiModule } from '../shared/silgi.B4uNbK2m.mjs';
5
5
  import 'defu';
6
6
  import '@graphql-tools/utils';
7
7
  import 'pkg-types';
@@ -1,7 +1,7 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import { GraphQLSchema } from 'graphql';
3
3
  import { SilgiCLI, GraphQLJSON, SilgiPreset, SilgiPresetMeta } from 'silgi/types';
4
- import { M as ModuleOptions, a as ModuleDefinition, S as SilgiModule } from '../shared/silgi.CN_giHTc.js';
4
+ import { M as ModuleOptions, a as ModuleDefinition, S as SilgiModule } from '../shared/silgi.B4uNbK2m.js';
5
5
  import 'defu';
6
6
  import '@graphql-tools/utils';
7
7
  import 'pkg-types';
@@ -1,3 +1,3 @@
1
- const version = "0.5.0";
1
+ const version = "0.6.0";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "0.5.0";
1
+ const version = "0.6.0";
2
2
 
3
3
  export { version };
@@ -1,4 +1,4 @@
1
- import { createError, defineEventHandler, getQuery, H3Error, readBody, setResponseStatus } from "h3";
1
+ import { createError, defineEventHandler, getQuery, H3Error, readBody } from "h3";
2
2
  import { silgi, SilgiError, useSilgi } from "silgi/core";
3
3
  export default async function addNitroApp(silgiCtx = useSilgi()) {
4
4
  const nitro = silgiCtx.framework;
@@ -30,7 +30,6 @@ export default async function addNitroApp(silgiCtx = useSilgi()) {
30
30
  }
31
31
  } catch (error) {
32
32
  if (error instanceof H3Error) {
33
- setResponseStatus(event, error.statusCode);
34
33
  throw createError({
35
34
  statusCode: error.statusCode,
36
35
  message: error.message,
@@ -337,6 +337,7 @@ interface SilgiCLI {
337
337
  timings?: Record<string, number | undefined>;
338
338
  entryPath: string;
339
339
  installed?: boolean;
340
+ options: Record<string, any>;
340
341
  }>;
341
342
  options: SilgiCLIOptions;
342
343
  _requiredModules: Record<string, boolean>;
@@ -392,7 +393,10 @@ interface SilgiCLIHooks {
392
393
  'module:register:after': (module: SilgiCLI['scanModules'][number]) => HookResult;
393
394
  'module:setup:finish': (module: SilgiModule) => HookResult;
394
395
  'prepare:createCoreFramework': (options: Pick<ImportItem, 'customImports' | 'importItems'> & {
395
- functions?: string[];
396
+ functions?: {
397
+ name: string;
398
+ params?: string[];
399
+ }[];
396
400
  }) => HookResult;
397
401
  'prepare:createDTSFramework': (options: ImportItem) => HookResult;
398
402
  /**
@@ -418,6 +422,10 @@ interface SilgiCLIHooks {
418
422
  shareds: string[];
419
423
  schemas: string[];
420
424
  buildSilgiExtraContent: string[];
425
+ _silgiOptions: {
426
+ [key: string]: any;
427
+ };
428
+ _silgiConfigs: any[];
421
429
  } & ImportItem) => HookResult;
422
430
  'after:prepare:core.ts': (content: string[]) => HookResult;
423
431
  'prepare:schema.ts': (options: {
@@ -337,6 +337,7 @@ interface SilgiCLI {
337
337
  timings?: Record<string, number | undefined>;
338
338
  entryPath: string;
339
339
  installed?: boolean;
340
+ options: Record<string, any>;
340
341
  }>;
341
342
  options: SilgiCLIOptions;
342
343
  _requiredModules: Record<string, boolean>;
@@ -392,7 +393,10 @@ interface SilgiCLIHooks {
392
393
  'module:register:after': (module: SilgiCLI['scanModules'][number]) => HookResult;
393
394
  'module:setup:finish': (module: SilgiModule) => HookResult;
394
395
  'prepare:createCoreFramework': (options: Pick<ImportItem, 'customImports' | 'importItems'> & {
395
- functions?: string[];
396
+ functions?: {
397
+ name: string;
398
+ params?: string[];
399
+ }[];
396
400
  }) => HookResult;
397
401
  'prepare:createDTSFramework': (options: ImportItem) => HookResult;
398
402
  /**
@@ -418,6 +422,10 @@ interface SilgiCLIHooks {
418
422
  shareds: string[];
419
423
  schemas: string[];
420
424
  buildSilgiExtraContent: string[];
425
+ _silgiOptions: {
426
+ [key: string]: any;
427
+ };
428
+ _silgiConfigs: any[];
421
429
  } & ImportItem) => HookResult;
422
430
  'after:prepare:core.ts': (content: string[]) => HookResult;
423
431
  'prepare:schema.ts': (options: {
@@ -6,6 +6,6 @@ declare function silgi(event?: SilgiEvent | Record<string, any>): {
6
6
  };
7
7
 
8
8
  declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
9
- declare function useStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base']): Storage<T>;
9
+ declare function useStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
10
10
 
11
11
  export { createStorage as c, silgi as s, useStorage as u };
@@ -6,6 +6,6 @@ declare function silgi(event?: SilgiEvent | Record<string, any>): {
6
6
  };
7
7
 
8
8
  declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
9
- declare function useStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base']): Storage<T>;
9
+ declare function useStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base'] | (string & {})): Storage<T>;
10
10
 
11
11
  export { createStorage as c, silgi as s, useStorage as u };
@@ -1,11 +1,11 @@
1
- import { b as SilgiOperation, c as SilgiEvent, d as ModuleConfigurations, B as BaseSchemaType, e as BaseSilgiMethodType, f as SilgiModules, D as DefaultHooks, g as SilgiModuleOptions, h as DeepPartial, H as HookResult, i as ModuleHookContext, j as DefaultNamespaces } from '../shared/silgi.CN_giHTc.mjs';
2
- export { A as AppConfig, t as Awaitable, C as CreateScope, W as ExtractInputFromURI, X as ExtractOutputFromURI, Y as ExtractRouterParamsFromURI, K as ImportItem, L as LoadConfigOptions, J as MergedSilgiSchema, a as ModuleDefinition, x as ModuleMeta, M as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, Q as NitroBuildInfo, R as ResolvedModuleMeta, y as ResolvedModuleOptions, N as SilgiCLI, l as SilgiCLIConfig, O as SilgiCLIDynamicConfig, m as SilgiCLIHooks, k as SilgiCLIOptions, w as SilgiCompatibility, n as SilgiCompatibilityIssue, o as SilgiCompatibilityIssues, P as SilgiFrameworkInfo, s as SilgiHook, p as SilgiMethods, S as SilgiModule, v as SilgiModuleInput, u as SilgiModuleMethods, q as SilgiNamespaces, F as SilgiPreset, G as SilgiPresetMeta, r as SilgiRouterTypes, I as SilgiSchema, U as SilgiURIs, T as TSReference, V as URIsTypes } from '../shared/silgi.CN_giHTc.mjs';
1
+ import { b as SilgiOperation, c as SilgiEvent, d as ModuleConfigurations, B as BaseSchemaType, e as BaseSilgiMethodType, f as SilgiModules, D as DefaultHooks, g as SilgiModuleOptions, h as DeepPartial, H as HookResult, i as ModuleHookContext, j as DefaultNamespaces } from '../shared/silgi.B4uNbK2m.mjs';
2
+ export { A as AppConfig, t as Awaitable, C as CreateScope, W as ExtractInputFromURI, X as ExtractOutputFromURI, Y as ExtractRouterParamsFromURI, K as ImportItem, L as LoadConfigOptions, J as MergedSilgiSchema, a as ModuleDefinition, x as ModuleMeta, M as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, Q as NitroBuildInfo, R as ResolvedModuleMeta, y as ResolvedModuleOptions, N as SilgiCLI, l as SilgiCLIConfig, O as SilgiCLIDynamicConfig, m as SilgiCLIHooks, k as SilgiCLIOptions, w as SilgiCompatibility, n as SilgiCompatibilityIssue, o as SilgiCompatibilityIssues, P as SilgiFrameworkInfo, s as SilgiHook, p as SilgiMethods, S as SilgiModule, v as SilgiModuleInput, u as SilgiModuleMethods, q as SilgiNamespaces, F as SilgiPreset, G as SilgiPresetMeta, r as SilgiRouterTypes, I as SilgiSchema, U as SilgiURIs, T as TSReference, V as URIsTypes } from '../shared/silgi.B4uNbK2m.mjs';
3
3
  import { ConsolaOptions, ConsolaInstance } from 'consola';
4
4
  import { PresetNameInput } from 'silgi/presets';
5
5
  import { BuiltinDriverName, TransactionOptions, Storage } from 'unstorage';
6
6
  import { Hookable } from 'hookable';
7
7
  import { Ignore } from 'ignore';
8
- import { u as useStorage, s as silgi } from '../shared/silgi.DGmIWx95.mjs';
8
+ import { u as useStorage, s as silgi } from '../shared/silgi.DRWtysQv.mjs';
9
9
  import { StandardSchemaV1 } from '@standard-schema/spec';
10
10
  import 'defu';
11
11
  import '@graphql-tools/utils';
@@ -178,7 +178,7 @@ interface Silgi {
178
178
  options: SilgiOptions & SilgiModuleOptions;
179
179
  captureError: CaptureError;
180
180
  }
181
- interface SilgiConfig extends Pick<Silgi, 'services' | 'shared' | 'uris' | 'schemas' | 'modulesURIs' | 'plugins' | 'framework'>, Partial<SilgiModuleOptions> {
181
+ interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiModuleOptions> {
182
182
  options: DeepPartial<SilgiOptions>;
183
183
  }
184
184
  type SilgiFunction = typeof silgi;
@@ -1,11 +1,11 @@
1
- import { b as SilgiOperation, c as SilgiEvent, d as ModuleConfigurations, B as BaseSchemaType, e as BaseSilgiMethodType, f as SilgiModules, D as DefaultHooks, g as SilgiModuleOptions, h as DeepPartial, H as HookResult, i as ModuleHookContext, j as DefaultNamespaces } from '../shared/silgi.CN_giHTc.js';
2
- export { A as AppConfig, t as Awaitable, C as CreateScope, W as ExtractInputFromURI, X as ExtractOutputFromURI, Y as ExtractRouterParamsFromURI, K as ImportItem, L as LoadConfigOptions, J as MergedSilgiSchema, a as ModuleDefinition, x as ModuleMeta, M as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, Q as NitroBuildInfo, R as ResolvedModuleMeta, y as ResolvedModuleOptions, N as SilgiCLI, l as SilgiCLIConfig, O as SilgiCLIDynamicConfig, m as SilgiCLIHooks, k as SilgiCLIOptions, w as SilgiCompatibility, n as SilgiCompatibilityIssue, o as SilgiCompatibilityIssues, P as SilgiFrameworkInfo, s as SilgiHook, p as SilgiMethods, S as SilgiModule, v as SilgiModuleInput, u as SilgiModuleMethods, q as SilgiNamespaces, F as SilgiPreset, G as SilgiPresetMeta, r as SilgiRouterTypes, I as SilgiSchema, U as SilgiURIs, T as TSReference, V as URIsTypes } from '../shared/silgi.CN_giHTc.js';
1
+ import { b as SilgiOperation, c as SilgiEvent, d as ModuleConfigurations, B as BaseSchemaType, e as BaseSilgiMethodType, f as SilgiModules, D as DefaultHooks, g as SilgiModuleOptions, h as DeepPartial, H as HookResult, i as ModuleHookContext, j as DefaultNamespaces } from '../shared/silgi.B4uNbK2m.js';
2
+ export { A as AppConfig, t as Awaitable, C as CreateScope, W as ExtractInputFromURI, X as ExtractOutputFromURI, Y as ExtractRouterParamsFromURI, K as ImportItem, L as LoadConfigOptions, J as MergedSilgiSchema, a as ModuleDefinition, x as ModuleMeta, M as ModuleOptions, z as ModuleSetupInstallResult, E as ModuleSetupReturn, Q as NitroBuildInfo, R as ResolvedModuleMeta, y as ResolvedModuleOptions, N as SilgiCLI, l as SilgiCLIConfig, O as SilgiCLIDynamicConfig, m as SilgiCLIHooks, k as SilgiCLIOptions, w as SilgiCompatibility, n as SilgiCompatibilityIssue, o as SilgiCompatibilityIssues, P as SilgiFrameworkInfo, s as SilgiHook, p as SilgiMethods, S as SilgiModule, v as SilgiModuleInput, u as SilgiModuleMethods, q as SilgiNamespaces, F as SilgiPreset, G as SilgiPresetMeta, r as SilgiRouterTypes, I as SilgiSchema, U as SilgiURIs, T as TSReference, V as URIsTypes } from '../shared/silgi.B4uNbK2m.js';
3
3
  import { ConsolaOptions, ConsolaInstance } from 'consola';
4
4
  import { PresetNameInput } from 'silgi/presets';
5
5
  import { BuiltinDriverName, TransactionOptions, Storage } from 'unstorage';
6
6
  import { Hookable } from 'hookable';
7
7
  import { Ignore } from 'ignore';
8
- import { u as useStorage, s as silgi } from '../shared/silgi.DGmIWx95.js';
8
+ import { u as useStorage, s as silgi } from '../shared/silgi.DRWtysQv.js';
9
9
  import { StandardSchemaV1 } from '@standard-schema/spec';
10
10
  import 'defu';
11
11
  import '@graphql-tools/utils';
@@ -178,7 +178,7 @@ interface Silgi {
178
178
  options: SilgiOptions & SilgiModuleOptions;
179
179
  captureError: CaptureError;
180
180
  }
181
- interface SilgiConfig extends Pick<Silgi, 'services' | 'shared' | 'uris' | 'schemas' | 'modulesURIs' | 'plugins' | 'framework'>, Partial<SilgiModuleOptions> {
181
+ interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiModuleOptions> {
182
182
  options: DeepPartial<SilgiOptions>;
183
183
  }
184
184
  type SilgiFunction = typeof silgi;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "sideEffects": false,
6
6
  "exports": {
7
7
  "./cli": {