@123ishatest/louter 0.1.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.
Files changed (47) hide show
  1. package/dist/content/ContentManager.d.ts +28 -0
  2. package/dist/content/ContentManager.d.ts.map +1 -0
  3. package/dist/core/Louter.d.ts +9 -0
  4. package/dist/core/Louter.d.ts.map +1 -0
  5. package/dist/core/LouterConfig.d.ts +4 -0
  6. package/dist/core/LouterConfig.d.ts.map +1 -0
  7. package/dist/core/LouterContext.d.ts +14 -0
  8. package/dist/core/LouterContext.d.ts.map +1 -0
  9. package/dist/core/LouterError.d.ts +7 -0
  10. package/dist/core/LouterError.d.ts.map +1 -0
  11. package/dist/core/LouterObject.d.ts +9 -0
  12. package/dist/core/LouterObject.d.ts.map +1 -0
  13. package/dist/core/LouterStage.d.ts +6 -0
  14. package/dist/core/LouterStage.d.ts.map +1 -0
  15. package/dist/core/LouterWarning.d.ts +7 -0
  16. package/dist/core/LouterWarning.d.ts.map +1 -0
  17. package/dist/core/LouterWarningType.d.ts +10 -0
  18. package/dist/core/LouterWarningType.d.ts.map +1 -0
  19. package/dist/core/types.d.ts +14 -0
  20. package/dist/core/types.d.ts.map +1 -0
  21. package/dist/core/util.d.ts +4 -0
  22. package/dist/core/util.d.ts.map +1 -0
  23. package/dist/export/LouterContentWriter.d.ts +12 -0
  24. package/dist/export/LouterContentWriter.d.ts.map +1 -0
  25. package/dist/export/LouterJsonSchemaWriter.d.ts +12 -0
  26. package/dist/export/LouterJsonSchemaWriter.d.ts.map +1 -0
  27. package/dist/index.cjs.js +170 -0
  28. package/dist/index.d.ts +31 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.es.js +14834 -0
  31. package/dist/loader/LouterFile.d.ts +8 -0
  32. package/dist/loader/LouterFile.d.ts.map +1 -0
  33. package/dist/loader/LouterFileLoader.d.ts +16 -0
  34. package/dist/loader/LouterFileLoader.d.ts.map +1 -0
  35. package/dist/node.cjs.js +1 -0
  36. package/dist/node.d.ts +10 -0
  37. package/dist/node.d.ts.map +1 -0
  38. package/dist/node.es.js +59 -0
  39. package/dist/parser/LouterJsonParser.d.ts +10 -0
  40. package/dist/parser/LouterJsonParser.d.ts.map +1 -0
  41. package/dist/parser/LouterYamlParser.d.ts +10 -0
  42. package/dist/parser/LouterYamlParser.d.ts.map +1 -0
  43. package/dist/util/file.d.ts +4 -0
  44. package/dist/util/file.d.ts.map +1 -0
  45. package/dist/validator/LouterValidator.d.ts +10 -0
  46. package/dist/validator/LouterValidator.d.ts.map +1 -0
  47. package/package.json +46 -0
@@ -0,0 +1,28 @@
1
+ import { z, ZodType } from 'zod';
2
+ import { ContentMapFromKinds } from '../core/types';
3
+ export declare class ContentManager<const Kinds extends Record<string, ZodType<{
4
+ id: string;
5
+ }>>> {
6
+ private readonly _content;
7
+ private readonly _kinds;
8
+ constructor(kinds: Kinds);
9
+ load(content: ContentMapFromKinds<Kinds>): void;
10
+ loadKind<Kind extends keyof Kinds>(kind: Kind, content: z.infer<Kinds[Kind]>[]): void;
11
+ getMap<Kind extends keyof Kinds>(kind: Kind): Record<string, z.infer<Kinds[Kind]>>;
12
+ /**
13
+ * Return the content for this kind as a list
14
+ * @param kind
15
+ */
16
+ getList<Kind extends keyof Kinds>(kind: Kind): z.core.output<Kinds[Kind]>[];
17
+ /**
18
+ * Return the specified piece of content
19
+ * @param id
20
+ * @param kind
21
+ */
22
+ get<Kind extends keyof Kinds>(id: string, kind: Kind): z.infer<Kinds[Kind]>;
23
+ /**
24
+ * Throw away all currently managed content
25
+ */
26
+ clear(): void;
27
+ }
28
+ //# sourceMappingURL=ContentManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentManager.d.ts","sourceRoot":"","sources":["../../src/content/ContentManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qBAAa,cAAc,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;IACrF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;IAEpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEnB,KAAK,EAAE,KAAK;IAKjB,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAG,IAAI;IAM/C,QAAQ,CAAC,IAAI,SAAS,MAAM,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE;IAO9E,MAAM,CAAC,IAAI,SAAS,MAAM,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAQzF;;;OAGG;IACI,OAAO,CAAC,IAAI,SAAS,MAAM,KAAK,EAAE,IAAI,EAAE,IAAI;IAInD;;;;OAIG;IACI,GAAG,CAAC,IAAI,SAAS,MAAM,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAQlF;;OAEG;IACI,KAAK;CAKb"}
@@ -0,0 +1,9 @@
1
+ import { KindDefinitions } from './types';
2
+ import { LouterStage } from './LouterStage';
3
+ import { LouterContext } from './LouterContext';
4
+ export declare class Louter {
5
+ private readonly _stages;
6
+ constructor(stages: LouterStage[]);
7
+ run<Kinds extends KindDefinitions>(kinds: Kinds): LouterContext<Kinds>;
8
+ }
9
+ //# sourceMappingURL=Louter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Louter.d.ts","sourceRoot":"","sources":["../../src/core/Louter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;gBAE5B,MAAM,EAAE,WAAW,EAAE;IAI1B,GAAG,CAAC,KAAK,SAAS,eAAe,EAAE,KAAK,EAAE,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;CAK9E"}
@@ -0,0 +1,4 @@
1
+ export interface LouterConfig {
2
+ debug?: boolean;
3
+ }
4
+ //# sourceMappingURL=LouterConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterConfig.d.ts","sourceRoot":"","sources":["../../src/core/LouterConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1,14 @@
1
+ import { ContentMapFromKinds, KindDefinitions } from './types';
2
+ import { LouterFile } from '../loader/LouterFile';
3
+ import { LouterConfig } from './LouterConfig';
4
+ import { LouterWarning } from './LouterWarning';
5
+ import { LouterObject } from './LouterObject';
6
+ export interface LouterContext<Kinds extends KindDefinitions> {
7
+ config: LouterConfig;
8
+ kinds: Kinds;
9
+ files: LouterFile[];
10
+ objects: LouterObject[];
11
+ content: ContentMapFromKinds<Kinds>;
12
+ warnings: LouterWarning[];
13
+ }
14
+ //# sourceMappingURL=LouterContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterContext.d.ts","sourceRoot":"","sources":["../../src/core/LouterContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,WAAW,aAAa,CAAC,KAAK,SAAS,eAAe;IAC1D,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IAGb,KAAK,EAAE,UAAU,EAAE,CAAC;IAGpB,OAAO,EAAE,YAAY,EAAE,CAAC;IAGxB,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAEpC,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B"}
@@ -0,0 +1,7 @@
1
+ export declare class LouterError extends Error {
2
+ }
3
+ export declare class ContentKindNotFoundError extends LouterError {
4
+ }
5
+ export declare class ContentNotFoundError extends LouterError {
6
+ }
7
+ //# sourceMappingURL=LouterError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterError.d.ts","sourceRoot":"","sources":["../../src/core/LouterError.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAEzC,qBAAa,wBAAyB,SAAQ,WAAW;CAAG;AAE5D,qBAAa,oBAAqB,SAAQ,WAAW;CAAG"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A content object
3
+ */
4
+ export interface LouterObject {
5
+ path: string;
6
+ kind: string;
7
+ data: Record<string, unknown>;
8
+ }
9
+ //# sourceMappingURL=LouterObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterObject.d.ts","sourceRoot":"","sources":["../../src/core/LouterObject.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
@@ -0,0 +1,6 @@
1
+ import { LouterContext } from './LouterContext';
2
+ import { KindDefinitions } from './types';
3
+ export interface LouterStage {
4
+ run<Kinds extends KindDefinitions>(ctx: LouterContext<Kinds>): void;
5
+ }
6
+ //# sourceMappingURL=LouterStage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterStage.d.ts","sourceRoot":"","sources":["../../src/core/LouterStage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,KAAK,SAAS,eAAe,EAAE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CACrE"}
@@ -0,0 +1,7 @@
1
+ import { LouterWarningType } from './LouterWarningType';
2
+ export interface LouterWarning {
3
+ path: string;
4
+ type: LouterWarningType;
5
+ message: string;
6
+ }
7
+ //# sourceMappingURL=LouterWarning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterWarning.d.ts","sourceRoot":"","sources":["../../src/core/LouterWarning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,10 @@
1
+ export declare enum LouterWarningType {
2
+ MissingKind = "MissingKind",
3
+ InvalidKind = "InvalidKind",
4
+ InvalidYaml = "InvalidYaml",
5
+ InvalidJson = "InvalidJson",
6
+ MissingGlobalIdKey = "MissingGlobalIdKey",
7
+ ZodParsingFailed = "ZodParsingFailed",
8
+ DuplicateId = "DuplicateId"
9
+ }
10
+ //# sourceMappingURL=LouterWarningType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterWarningType.d.ts","sourceRoot":"","sources":["../../src/core/LouterWarningType.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B"}
@@ -0,0 +1,14 @@
1
+ import { default as z, ZodType } from 'zod';
2
+ export declare const ContentSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type Content = z.infer<typeof ContentSchema>;
6
+ export type ContentMapFromKinds<Kinds extends Record<string, ZodType<{
7
+ id: string;
8
+ }>>> = {
9
+ [Kind in keyof Kinds]: Record<string, z.infer<Kinds[Kind]>>;
10
+ };
11
+ export type KindDefinitions = Record<string, ZodType<{
12
+ id: string;
13
+ }>>;
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,eAAO,MAAM,aAAa;;iBAExB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,IAAI;KACtF,IAAI,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { LouterContext } from './LouterContext';
2
+ import { KindDefinitions } from './types';
3
+ export declare const createContext: <Kinds extends KindDefinitions>(kinds: Kinds) => LouterContext<Kinds>;
4
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/core/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAuB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1E,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,eAAe,EAAE,OAAO,KAAK,KAAG,aAAa,CAAC,KAAK,CAgB9F,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { KindDefinitions } from '../core/types';
2
+ import { LouterStage } from '../core/LouterStage';
3
+ import { LouterContext } from '../core/LouterContext';
4
+ /**
5
+ * Write all content to a big JSON file
6
+ */
7
+ export declare class LouterContentWriter implements LouterStage {
8
+ private readonly _directory;
9
+ constructor(directory?: string);
10
+ run<Kinds extends KindDefinitions>(ctx: LouterContext<Kinds>): void;
11
+ }
12
+ //# sourceMappingURL=LouterContentWriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterContentWriter.d.ts","sourceRoot":"","sources":["../../src/export/LouterContentWriter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;GAEG;AACH,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,SAAS,GAAE,MAAkB;IAIzC,GAAG,CAAC,KAAK,SAAS,eAAe,EAAE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;CAYpE"}
@@ -0,0 +1,12 @@
1
+ import { KindDefinitions } from '../core/types';
2
+ import { LouterStage } from '../core/LouterStage';
3
+ import { LouterContext } from '../core/LouterContext.ts';
4
+ /**
5
+ * Write all JSON schemas to the specified directory
6
+ */
7
+ export declare class LouterJsonSchemaWriter implements LouterStage {
8
+ private readonly _directory;
9
+ constructor(directory?: string);
10
+ run<Kinds extends KindDefinitions>(ctx: LouterContext<Kinds>): void;
11
+ }
12
+ //# sourceMappingURL=LouterJsonSchemaWriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LouterJsonSchemaWriter.d.ts","sourceRoot":"","sources":["../../src/export/LouterJsonSchemaWriter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;GAEG;AACH,qBAAa,sBAAuB,YAAW,WAAW;IACxD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,SAAS,GAAE,MAAkB;IAIzC,GAAG,CAAC,KAAK,SAAS,eAAe,EAAE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;CAUpE"}