@fakeware/core 0.0.2
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/config/index.d.mts +52 -0
- package/dist/config/index.mjs +40 -0
- package/dist/config/index.mjs.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/config/schema.d.ts
|
|
4
|
+
declare const shopwareSchema: z.ZodObject<{
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
clientId: z.ZodString;
|
|
7
|
+
clientSecret: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const mediaSchema: z.ZodObject<{
|
|
10
|
+
provider: z.ZodString;
|
|
11
|
+
perProduct: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
min: z.ZodNumber;
|
|
13
|
+
max: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
declare const pluginRefSchema: z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>, z.ZodUnknown]>;
|
|
17
|
+
declare const fakewareConfigSchema: z.ZodObject<{
|
|
18
|
+
extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
19
|
+
shopware: z.ZodObject<{
|
|
20
|
+
url: z.ZodString;
|
|
21
|
+
clientId: z.ZodString;
|
|
22
|
+
clientSecret: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
25
|
+
seed: z.ZodOptional<z.ZodString>;
|
|
26
|
+
batchSize: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
generators: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
provider: z.ZodString;
|
|
30
|
+
perProduct: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
min: z.ZodNumber;
|
|
32
|
+
max: z.ZodNumber;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
scenario: z.ZodOptional<z.ZodString>;
|
|
36
|
+
scenarios: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
37
|
+
plugins: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>, z.ZodUnknown]>>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
type FakewareConfig = z.output<typeof fakewareConfigSchema>;
|
|
40
|
+
type FakewareUserConfig = z.input<typeof fakewareConfigSchema>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/config/define.d.ts
|
|
43
|
+
interface ConfigEnv {
|
|
44
|
+
env: Record<string, string | undefined>;
|
|
45
|
+
mode: string;
|
|
46
|
+
}
|
|
47
|
+
type FakewareConfigFn = (env: ConfigEnv) => FakewareUserConfig;
|
|
48
|
+
declare function defineConfig(config: FakewareUserConfig): FakewareUserConfig;
|
|
49
|
+
declare function defineConfig(config: FakewareConfigFn): FakewareConfigFn;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { type ConfigEnv, type FakewareConfig, type FakewareConfigFn, type FakewareUserConfig, defineConfig, fakewareConfigSchema, mediaSchema, pluginRefSchema, shopwareSchema };
|
|
52
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/config/define.ts
|
|
3
|
+
function defineConfig(config) {
|
|
4
|
+
return config;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/config/schema.ts
|
|
8
|
+
const shopwareSchema = z.object({
|
|
9
|
+
url: z.string().min(1, "shopware.url is required"),
|
|
10
|
+
clientId: z.string().min(1, "shopware.clientId is required"),
|
|
11
|
+
clientSecret: z.string().min(1, "shopware.clientSecret is required")
|
|
12
|
+
});
|
|
13
|
+
const mediaSchema = z.object({
|
|
14
|
+
provider: z.string(),
|
|
15
|
+
perProduct: z.object({
|
|
16
|
+
min: z.number().int().nonnegative(),
|
|
17
|
+
max: z.number().int().nonnegative()
|
|
18
|
+
}).optional()
|
|
19
|
+
});
|
|
20
|
+
const pluginRefSchema = z.union([
|
|
21
|
+
z.string(),
|
|
22
|
+
z.tuple([z.string(), z.record(z.string(), z.unknown())]),
|
|
23
|
+
z.unknown()
|
|
24
|
+
]);
|
|
25
|
+
const fakewareConfigSchema = z.object({
|
|
26
|
+
extends: z.union([z.string(), z.array(z.string())]).optional(),
|
|
27
|
+
shopware: shopwareSchema,
|
|
28
|
+
locale: z.string().optional(),
|
|
29
|
+
seed: z.string().optional(),
|
|
30
|
+
batchSize: z.number().int().positive().default(100),
|
|
31
|
+
generators: z.record(z.string(), z.unknown()).default({}),
|
|
32
|
+
media: mediaSchema.optional(),
|
|
33
|
+
scenario: z.string().optional(),
|
|
34
|
+
scenarios: z.record(z.string(), z.unknown()).default({}),
|
|
35
|
+
plugins: z.array(pluginRefSchema).default([])
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { defineConfig, fakewareConfigSchema, mediaSchema, pluginRefSchema, shopwareSchema };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/config/define.ts","../../src/config/schema.ts"],"sourcesContent":["import type { FakewareUserConfig } from './schema'\n\nexport interface ConfigEnv {\n env: Record<string, string | undefined>\n mode: string\n}\n\nexport type FakewareConfigFn = (env: ConfigEnv) => FakewareUserConfig\n\nexport function defineConfig(config: FakewareUserConfig): FakewareUserConfig\nexport function defineConfig(config: FakewareConfigFn): FakewareConfigFn\nexport function defineConfig(\n config: FakewareUserConfig | FakewareConfigFn,\n): FakewareUserConfig | FakewareConfigFn {\n return config\n}\n","import { z } from 'zod'\n\nexport const shopwareSchema = z.object({\n url: z.string().min(1, 'shopware.url is required'),\n clientId: z.string().min(1, 'shopware.clientId is required'),\n clientSecret: z.string().min(1, 'shopware.clientSecret is required'),\n})\n\nexport const mediaSchema = z.object({\n provider: z.string(),\n perProduct: z\n .object({\n min: z.number().int().nonnegative(),\n max: z.number().int().nonnegative(),\n })\n .optional(),\n})\n\nexport const pluginRefSchema = z.union([\n z.string(),\n z.tuple([z.string(), z.record(z.string(), z.unknown())]),\n z.unknown(),\n])\n\nexport const fakewareConfigSchema = z.object({\n extends: z.union([z.string(), z.array(z.string())]).optional(),\n shopware: shopwareSchema,\n locale: z.string().optional(),\n seed: z.string().optional(),\n batchSize: z.number().int().positive().default(100),\n generators: z.record(z.string(), z.unknown()).default({}),\n media: mediaSchema.optional(),\n scenario: z.string().optional(),\n scenarios: z.record(z.string(), z.unknown()).default({}),\n plugins: z.array(pluginRefSchema).default([]),\n})\n\nexport type FakewareConfig = z.output<typeof fakewareConfigSchema>\n\nexport type FakewareUserConfig = z.input<typeof fakewareConfigSchema>\n"],"mappings":";;AAWA,SAAgB,aACd,QACuC;CACvC,OAAO;AACT;;;ACbA,MAAa,iBAAiB,EAAE,OAAO;CACrC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,0BAA0B;CACjD,UAAU,EAAE,OAAO,EAAE,IAAI,GAAG,+BAA+B;CAC3D,cAAc,EAAE,OAAO,EAAE,IAAI,GAAG,mCAAmC;AACrE,CAAC;AAED,MAAa,cAAc,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,YAAY,EACT,OAAO;EACN,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY;EAClC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY;CACpC,CAAC,EACA,SAAS;AACd,CAAC;AAED,MAAa,kBAAkB,EAAE,MAAM;CACrC,EAAE,OAAO;CACT,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;CACvD,EAAE,QAAQ;AACZ,CAAC;AAED,MAAa,uBAAuB,EAAE,OAAO;CAC3C,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;CAC7D,UAAU;CACV,QAAQ,EAAE,OAAO,EAAE,SAAS;CAC5B,MAAM,EAAE,OAAO,EAAE,SAAS;CAC1B,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAG;CAClD,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;CACxD,OAAO,YAAY,SAAS;CAC5B,UAAU,EAAE,OAAO,EAAE,SAAS;CAC9B,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;CACvD,SAAS,EAAE,MAAM,eAAe,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fakeware/core",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Fakeware core library. Currently exposes the typed configuration surface (@fakeware-sh/core/config); the engine and plugin SDK arrive in later releases.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/fakeware-sh/fakeware.git",
|
|
10
|
+
"directory": "packages/core"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
"./config": {
|
|
20
|
+
"types": "./dist/config/index.d.mts",
|
|
21
|
+
"import": "./dist/config/index.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsdown",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
27
|
+
"test": "bun test"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"zod": "4.4.3"
|
|
31
|
+
}
|
|
32
|
+
}
|