silgi 0.11.1 → 0.11.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/_chunks/index.mjs +1 -1
- package/dist/cli/dev.mjs +0 -1
- package/dist/cli/prepare.mjs +0 -1
- package/dist/cli/writeTypesAndFiles.mjs +50 -34
- package/dist/core/index.d.mts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +7 -4
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/runtime/internal/nitro.mjs +1 -2
- package/dist/shared/{silgi.D608K9c5.d.mts → silgi.Cs0ZUUXV.d.mts} +1 -1
- package/dist/shared/{silgi.D608K9c5.d.ts → silgi.Cs0ZUUXV.d.ts} +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/dev.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -4,13 +4,12 @@ import consola$1, { consola } from 'consola';
|
|
|
4
4
|
import { createHooks, createDebugger } from 'hookable';
|
|
5
5
|
import { join, resolve, isAbsolute, relative, dirname, basename, extname } from 'pathe';
|
|
6
6
|
import { useSilgiCLI, silgiCLICtx } from 'silgi/core';
|
|
7
|
-
import { relativeWithDot, resolveAlias, resolvePath, writeFile,
|
|
7
|
+
import { relativeWithDot, hash, resolveAlias, resolvePath, writeFile, normalizeTemplate, useLogger, addTemplate, applyEnv, hasError as hasError$1, isDirectory } from 'silgi/kit';
|
|
8
8
|
import { runtimeDir } from 'silgi/runtime/meta';
|
|
9
9
|
import { autoImportTypes } from 'silgi/types';
|
|
10
10
|
import { scanExports, createUnimport, toExports } from 'unimport';
|
|
11
11
|
import { p as prepareEnv } from './env.mjs';
|
|
12
12
|
import { resolveModuleExportNames, resolve as resolve$1, resolvePath as resolvePath$1, parseNodeModulePath, lookupNodeModuleSubpath } from 'mlly';
|
|
13
|
-
import { pascalCase } from 'scule';
|
|
14
13
|
import { createJiti } from 'dev-jiti';
|
|
15
14
|
import { a as hasInstalledModule, h as hasError } from './compatibility.mjs';
|
|
16
15
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
@@ -117,7 +116,11 @@ async function nitroFramework(silgi, skip = false) {
|
|
|
117
116
|
silgi.hook("prepare:schema.ts", (data) => {
|
|
118
117
|
data.importItems.nitropack = {
|
|
119
118
|
import: [
|
|
120
|
-
{
|
|
119
|
+
{
|
|
120
|
+
name: "NitroApp",
|
|
121
|
+
type: true,
|
|
122
|
+
key: "NitroApp"
|
|
123
|
+
}
|
|
121
124
|
],
|
|
122
125
|
from: "nitropack/types"
|
|
123
126
|
};
|
|
@@ -132,7 +135,11 @@ async function nitroFramework(silgi, skip = false) {
|
|
|
132
135
|
silgi.hook("prepare:createDTSFramework", (data) => {
|
|
133
136
|
data.importItems["nitropack/types"] = {
|
|
134
137
|
import: [
|
|
135
|
-
{
|
|
138
|
+
{
|
|
139
|
+
name: "NitroRuntimeConfig",
|
|
140
|
+
type: true,
|
|
141
|
+
key: "NitroRuntimeConfig"
|
|
142
|
+
}
|
|
136
143
|
],
|
|
137
144
|
from: "nitropack/types"
|
|
138
145
|
};
|
|
@@ -229,74 +236,83 @@ async function registerModuleExportScan(silgi) {
|
|
|
229
236
|
};
|
|
230
237
|
const exportedTypes = exports.filter((exp) => exp.type).map((exp) => exp.name);
|
|
231
238
|
if (exportedTypes.includes("ModuleOptions")) {
|
|
232
|
-
const importName =
|
|
239
|
+
const importName = `_${hash(`${configKey}ModuleOptions`)}`;
|
|
233
240
|
options.importItems[configKey].import.push({
|
|
234
241
|
name: `ModuleOptions as ${importName}`,
|
|
235
|
-
type: true
|
|
242
|
+
type: true,
|
|
243
|
+
key: importName
|
|
236
244
|
});
|
|
237
245
|
options.options.push({ key: configKey, value: importName });
|
|
238
246
|
}
|
|
239
|
-
if (exportedTypes.includes("
|
|
240
|
-
const importName =
|
|
247
|
+
if (exportedTypes.includes("ModuleRuntimeOptions")) {
|
|
248
|
+
const importName = `_${hash(`${configKey}ModuleRuntimeOptions`)}`;
|
|
241
249
|
options.importItems[configKey].import.push({
|
|
242
|
-
name: `
|
|
243
|
-
type: true
|
|
250
|
+
name: `ModuleRuntimeOptions as ${importName}`,
|
|
251
|
+
type: true,
|
|
252
|
+
key: importName
|
|
244
253
|
});
|
|
245
254
|
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
246
255
|
}
|
|
247
|
-
if (exportedTypes.includes("
|
|
248
|
-
const importName =
|
|
256
|
+
if (exportedTypes.includes("ModuleRuntimeShareds")) {
|
|
257
|
+
const importName = `_${hash(`${configKey}ModuleRuntimeShareds`)}`;
|
|
249
258
|
options.importItems[configKey].import.push({
|
|
250
|
-
name: `
|
|
251
|
-
type: true
|
|
259
|
+
name: `ModuleRuntimeShareds as ${importName}`,
|
|
260
|
+
type: true,
|
|
261
|
+
key: importName
|
|
252
262
|
});
|
|
253
263
|
options.contexts.push({ key: configKey, value: importName });
|
|
254
264
|
}
|
|
255
|
-
if (exportedTypes.includes("
|
|
256
|
-
const importName =
|
|
265
|
+
if (exportedTypes.includes("ModuleEvents")) {
|
|
266
|
+
const importName = `_${hash(`${configKey}ModuleEvents`)}`;
|
|
257
267
|
options.importItems[configKey].import.push({
|
|
258
|
-
name: `
|
|
259
|
-
type: true
|
|
268
|
+
name: `ModuleEvents as ${importName}`,
|
|
269
|
+
type: true,
|
|
270
|
+
key: importName
|
|
260
271
|
});
|
|
261
272
|
options.actions.push({ key: configKey, value: importName });
|
|
262
273
|
}
|
|
263
|
-
if (exportedTypes.includes("
|
|
264
|
-
const importName =
|
|
274
|
+
if (exportedTypes.includes("ModuleRuntimeContexts")) {
|
|
275
|
+
const importName = `_${hash(`${configKey}ModuleRuntimeContexts`)}`;
|
|
265
276
|
options.importItems[configKey].import.push({
|
|
266
|
-
name: `
|
|
267
|
-
type: true
|
|
277
|
+
name: `ModuleRuntimeContexts as ${importName}`,
|
|
278
|
+
type: true,
|
|
279
|
+
key: importName
|
|
268
280
|
});
|
|
269
281
|
options.shareds.push({ key: configKey, value: importName });
|
|
270
282
|
}
|
|
271
283
|
if (exportedTypes.includes("ModuleHooks")) {
|
|
272
|
-
const importName =
|
|
284
|
+
const importName = `_${hash(`${configKey}ModuleHooks`)}`;
|
|
273
285
|
options.importItems[configKey].import.push({
|
|
274
286
|
name: `ModuleHooks as ${importName}`,
|
|
275
|
-
type: true
|
|
287
|
+
type: true,
|
|
288
|
+
key: importName
|
|
276
289
|
});
|
|
277
290
|
options.hooks.push({ key: configKey, value: importName });
|
|
278
291
|
}
|
|
279
292
|
if (exportedTypes.includes("ModuleRuntimeHooks")) {
|
|
280
|
-
const importName =
|
|
293
|
+
const importName = `_${hash(`${configKey}RuntimeHooks`)}`;
|
|
281
294
|
options.importItems[configKey].import.push({
|
|
282
295
|
name: `ModuleRuntimeHooks as ${importName}`,
|
|
283
|
-
type: true
|
|
296
|
+
type: true,
|
|
297
|
+
key: importName
|
|
284
298
|
});
|
|
285
299
|
options.runtimeHooks.push({ key: configKey, value: importName });
|
|
286
300
|
}
|
|
287
|
-
if (exportedTypes.includes("
|
|
288
|
-
const importName =
|
|
301
|
+
if (exportedTypes.includes("ModuleRuntimeActions")) {
|
|
302
|
+
const importName = `_${hash(`${configKey}ModuleRuntimeActions`)}`;
|
|
289
303
|
options.importItems[configKey].import.push({
|
|
290
|
-
name: `
|
|
291
|
-
type: true
|
|
304
|
+
name: `ModuleRuntimeActions as ${importName}`,
|
|
305
|
+
type: true,
|
|
306
|
+
key: importName
|
|
292
307
|
});
|
|
293
308
|
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
294
309
|
}
|
|
295
|
-
if (exportedTypes.includes("
|
|
296
|
-
const importName =
|
|
310
|
+
if (exportedTypes.includes("ModuleRuntimeMethods")) {
|
|
311
|
+
const importName = `_${hash(`${configKey}ModuleRuntimeMethods`)}`;
|
|
297
312
|
options.importItems[configKey].import.push({
|
|
298
|
-
name: `
|
|
299
|
-
type: true
|
|
313
|
+
name: `ModuleRuntimeMethods as ${importName}`,
|
|
314
|
+
type: true,
|
|
315
|
+
key: importName
|
|
300
316
|
});
|
|
301
317
|
options.methods.push({ key: configKey, value: importName });
|
|
302
318
|
}
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiRuntimeSharedExtends, SilgiEvents, SilgiRuntimeContext, DefaultNamespaces, BaseSchemaType, SilgiRuntimeShareds, StorageConfig, SilgiCLI } from 'silgi/types';
|
|
2
|
-
export { s as silgi } from '../shared/silgi.
|
|
2
|
+
export { s as silgi } from '../shared/silgi.Cs0ZUUXV.mjs';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
4
|
import { Storage, StorageValue } from 'unstorage';
|
|
5
5
|
import * as unctx from 'unctx';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, SilgiRuntimeSharedExtends, SilgiEvents, SilgiRuntimeContext, DefaultNamespaces, BaseSchemaType, SilgiRuntimeShareds, StorageConfig, SilgiCLI } from 'silgi/types';
|
|
2
|
-
export { s as silgi } from '../shared/silgi.
|
|
2
|
+
export { s as silgi } from '../shared/silgi.Cs0ZUUXV.js';
|
|
3
3
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
4
|
import { Storage, StorageValue } from 'unstorage';
|
|
5
5
|
import * as unctx from 'unctx';
|
package/dist/core/index.mjs
CHANGED
|
@@ -541,12 +541,12 @@ async function createSilgi(config) {
|
|
|
541
541
|
|
|
542
542
|
function silgi(event) {
|
|
543
543
|
return {
|
|
544
|
-
execute: (uriString, input, source) => {
|
|
545
|
-
return execute(uriString, input, event, source);
|
|
544
|
+
execute: (uriString, input, source, queryParams) => {
|
|
545
|
+
return execute(uriString, input, event, source, queryParams);
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
async function execute(uriString, input, event, source) {
|
|
549
|
+
async function execute(uriString, input, event, source, queryParams) {
|
|
550
550
|
const silgiCtx = useSilgi();
|
|
551
551
|
const config = {
|
|
552
552
|
returnNull: false
|
|
@@ -589,7 +589,10 @@ async function execute(uriString, input, event, source) {
|
|
|
589
589
|
success = cacheData.success;
|
|
590
590
|
cached = cacheData.cached;
|
|
591
591
|
} else {
|
|
592
|
-
|
|
592
|
+
let parameters = defu$1(operation.routerParams, operation.query) || {};
|
|
593
|
+
if (queryParams) {
|
|
594
|
+
parameters = defu$1(queryParams, parameters);
|
|
595
|
+
}
|
|
593
596
|
silgiCtx.shared.silgi = (_event) => silgi(_event || event);
|
|
594
597
|
result = await handler?.handler(
|
|
595
598
|
defu$1(input, { parameters }),
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
|
@@ -14,9 +14,8 @@ export default async function addNitroApp(silgiCtx = useSilgi()) {
|
|
|
14
14
|
newPath = `${event.path}?method=${event.method}`;
|
|
15
15
|
}
|
|
16
16
|
const data = await silgiConnect.execute(newPath, {
|
|
17
|
-
...query,
|
|
18
17
|
...body
|
|
19
|
-
});
|
|
18
|
+
}, void 0, query);
|
|
20
19
|
if (data) {
|
|
21
20
|
return data;
|
|
22
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI } from 'silgi/types';
|
|
2
2
|
|
|
3
3
|
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
4
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
4
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>, queryParams?: Record<string, string>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { silgi as s };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI } from 'silgi/types';
|
|
2
2
|
|
|
3
3
|
declare function silgi(event?: SilgiEvents | Record<string, any>): {
|
|
4
|
-
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
4
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>, queryParams?: Record<string, string>) => Promise<ExtractOutputFromURI<TURI>>;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { silgi as s };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ import { Unimport } from 'unimport';
|
|
|
13
13
|
import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
|
|
14
14
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
|
-
import { s as silgi } from '../shared/silgi.
|
|
16
|
+
import { s as silgi } from '../shared/silgi.Cs0ZUUXV.mjs';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { Unimport } from 'unimport';
|
|
|
13
13
|
import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
|
|
14
14
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
15
15
|
import { ProviderName } from 'std-env';
|
|
16
|
-
import { s as silgi } from '../shared/silgi.
|
|
16
|
+
import { s as silgi } from '../shared/silgi.Cs0ZUUXV.js';
|
|
17
17
|
|
|
18
18
|
type HookResult = Promise<void> | void;
|
|
19
19
|
|