silgi 0.3.12 → 0.4.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/README.md +1 -31
- package/cli.d.ts +1 -0
- package/config.d.ts +1 -0
- package/core.d.ts +1 -0
- package/dist/_chunks/index.mjs +233 -0
- package/dist/cli/compatibility.mjs +42 -0
- package/dist/cli/index.mjs +3 -178
- package/dist/cli/prepare.mjs +1346 -0
- package/dist/config/index.d.mts +5 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/core/index.d.mts +136 -0
- package/dist/core/index.d.ts +136 -0
- package/dist/core/index.mjs +1444 -0
- package/dist/ecosystem/nitro/index.mjs +21 -10
- package/dist/ecosystem/nuxt/module.mjs +4 -6
- package/dist/kit/index.d.mts +90 -0
- package/dist/kit/index.d.ts +90 -0
- package/dist/kit/index.mjs +316 -0
- package/dist/meta/index.d.mts +3 -0
- package/dist/meta/index.d.ts +3 -0
- package/dist/meta/index.mjs +1 -0
- package/dist/presets/_all.gen.d.ts +2 -0
- package/dist/presets/_all.gen.mjs +8 -0
- package/dist/presets/_resolve.d.ts +8 -0
- package/dist/presets/_resolve.mjs +58 -0
- package/dist/presets/_types.gen.d.ts +5 -0
- package/dist/presets/_types.gen.mjs +1 -0
- package/dist/presets/h3/preset.d.ts +2 -0
- package/dist/presets/h3/preset.mjs +22 -0
- package/dist/presets/index.d.mts +1 -0
- package/dist/presets/index.d.ts +2 -0
- package/dist/presets/index.mjs +1 -0
- package/dist/presets/nitro/preset.d.ts +2 -0
- package/dist/presets/nitro/preset.mjs +26 -0
- package/dist/presets/npmpackage/preset.d.ts +2 -0
- package/dist/presets/npmpackage/preset.mjs +23 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.mjs +1 -0
- package/dist/runtime/internal/debug.d.ts +2 -0
- package/dist/runtime/internal/debug.mjs +5 -0
- package/dist/runtime/internal/nitro.d.ts +2 -0
- package/dist/runtime/internal/nitro.mjs +45 -0
- package/dist/runtime/internal/plugin.d.ts +3 -0
- package/dist/runtime/internal/plugin.mjs +4 -0
- package/dist/shared/silgi.40ZJYm8F.d.mts +11 -0
- package/dist/shared/silgi.40ZJYm8F.d.ts +11 -0
- package/dist/shared/{silgi.ClpvycKI.d.mts → silgi.D8h2AAVk.d.ts} +451 -437
- package/dist/shared/{silgi.ClpvycKI.d.ts → silgi.DSHNePNA.d.mts} +451 -437
- package/dist/types/index.d.mts +42 -0
- package/dist/types/index.d.ts +42 -0
- package/dist/types/index.mjs +1 -0
- package/kit.d.ts +1 -0
- package/meta.d.ts +1 -0
- package/package.json +89 -39
- package/presets.d.ts +1 -0
- package/runtime-meta.d.ts +4 -0
- package/runtime-meta.mjs +32 -0
- package/runtime.d.ts +1 -0
- package/types.d.ts +1 -0
- package/bin/silgi.mjs +0 -3
- package/dist/chunks/generate.mjs +0 -1258
- package/dist/cli/config.d.mts +0 -1633
- package/dist/cli/config.d.ts +0 -1633
- package/dist/index.d.mts +0 -196
- package/dist/index.d.ts +0 -196
- package/dist/index.mjs +0 -499
- package/dist/shared/silgi.b9yhSIGd.mjs +0 -459
- package/dist/shared/silgi.mBwNj1W0.mjs +0 -386
- /package/dist/{chunks → cli}/init.mjs +0 -0
- /package/dist/{cli/config.mjs → config/index.mjs} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
+
const h3 = defineSilgiPreset(
|
|
3
|
+
{
|
|
4
|
+
static: true,
|
|
5
|
+
output: {
|
|
6
|
+
dir: "{{ rootDir }}/.output",
|
|
7
|
+
publicDir: "{{ output.dir }}/public"
|
|
8
|
+
},
|
|
9
|
+
prerender: {
|
|
10
|
+
crawlLinks: true
|
|
11
|
+
},
|
|
12
|
+
commands: {
|
|
13
|
+
preview: "npx serve ./public"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "h3",
|
|
18
|
+
static: true,
|
|
19
|
+
url: import.meta.url
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
export default [h3];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolvePreset } from "./_resolve";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolvePreset } from './_resolve.mjs'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
+
const nitro = defineSilgiPreset(
|
|
3
|
+
{
|
|
4
|
+
static: true,
|
|
5
|
+
output: {
|
|
6
|
+
dir: "{{ rootDir }}/.output",
|
|
7
|
+
publicDir: "{{ output.dir }}/public"
|
|
8
|
+
},
|
|
9
|
+
prerender: {
|
|
10
|
+
crawlLinks: true
|
|
11
|
+
},
|
|
12
|
+
typescript: {
|
|
13
|
+
generateTsConfig: false,
|
|
14
|
+
tsconfigPath: ".nitro/types/silgi.tsconfig.json"
|
|
15
|
+
},
|
|
16
|
+
commands: {
|
|
17
|
+
preview: "npx serve ./public"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "nitro",
|
|
22
|
+
static: true,
|
|
23
|
+
url: import.meta.url
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
export default [nitro];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
+
const npmPackage = defineSilgiPreset(
|
|
3
|
+
{
|
|
4
|
+
output: {
|
|
5
|
+
dir: "{{ rootDir }}/.output",
|
|
6
|
+
publicDir: "{{ output.dir }}/public"
|
|
7
|
+
},
|
|
8
|
+
serverDir: "{{ rootDir }}/src",
|
|
9
|
+
silgi: {
|
|
10
|
+
serverDir: "{{ serverDir }}/silgi"
|
|
11
|
+
},
|
|
12
|
+
modules: ["./src"],
|
|
13
|
+
commands: {
|
|
14
|
+
preview: "npx serve ./public"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "npm-package",
|
|
19
|
+
compatibilityDate: "2025-02-04",
|
|
20
|
+
url: import.meta.url
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export default [npmPackage];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineSilgiPlugin } from './internal/plugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineSilgiPlugin } from "./internal/plugin.mjs";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createError, defineEventHandler, getQuery, readBody } from "h3";
|
|
2
|
+
import { silgi, SilgiError, useSilgi } from "silgi/core";
|
|
3
|
+
export default async function addNitroApp(silgiCtx = useSilgi()) {
|
|
4
|
+
const nitro = silgiCtx.framework;
|
|
5
|
+
nitro.router.use("/srn/**", defineEventHandler({
|
|
6
|
+
handler: async (event) => {
|
|
7
|
+
const ctx = useSilgi();
|
|
8
|
+
if (ctx.options.environment === "nitrojs" || ctx.options.environment === "h3") {
|
|
9
|
+
const silgiConnect = silgi(event);
|
|
10
|
+
const query = getQuery(event);
|
|
11
|
+
const body = await readBody(event).catch(() => {
|
|
12
|
+
});
|
|
13
|
+
let newPath = event.path;
|
|
14
|
+
if (event.path.includes("?")) {
|
|
15
|
+
newPath = `${event.path}&method=${event.method}`;
|
|
16
|
+
} else {
|
|
17
|
+
newPath = `${event.path}?method=${event.method}`;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const data = await silgiConnect.execute(newPath, {
|
|
21
|
+
...query,
|
|
22
|
+
...body
|
|
23
|
+
});
|
|
24
|
+
if (data.success) {
|
|
25
|
+
return data.data;
|
|
26
|
+
}
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (error instanceof SilgiError && error.code.startsWith("URI_PARSE_ERROR")) {
|
|
29
|
+
throw createError({
|
|
30
|
+
statusCode: 400,
|
|
31
|
+
message: error.message
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
path: event.path,
|
|
38
|
+
method: event.method,
|
|
39
|
+
body,
|
|
40
|
+
query
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SilgiEvent, SilgiURIs, ExtractInputFromURI, MethodResponse, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
|
|
2
|
+
import { Storage, StorageValue } from 'unstorage';
|
|
3
|
+
|
|
4
|
+
declare function silgi(event?: SilgiEvent | Record<string, any>): {
|
|
5
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<MethodResponse<ExtractOutputFromURI<TURI>>>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
9
|
+
declare function useStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base']): Storage<T>;
|
|
10
|
+
|
|
11
|
+
export { createStorage as c, silgi as s, useStorage as u };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SilgiEvent, SilgiURIs, ExtractInputFromURI, MethodResponse, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
|
|
2
|
+
import { Storage, StorageValue } from 'unstorage';
|
|
3
|
+
|
|
4
|
+
declare function silgi(event?: SilgiEvent | Record<string, any>): {
|
|
5
|
+
execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<MethodResponse<ExtractOutputFromURI<TURI>>>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
9
|
+
declare function useStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>['base']): Storage<T>;
|
|
10
|
+
|
|
11
|
+
export { createStorage as c, silgi as s, useStorage as u };
|