@molda-org/core 0.1.0-next.0 → 0.1.0-next.10
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/index.d.ts +137 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/package.json +16 -5
- package/index.d.ts +0 -20
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { type ModuleRepository } from '@molda-org/module-runtime';
|
|
4
|
+
export type CoreAction = 'updateProjectConfiguration' | 'setFeatureFlag';
|
|
5
|
+
export type CoreView = 'projectConfiguration' | 'featureFlags';
|
|
6
|
+
export type CoreHook = 'useProjectConfiguration' | 'useFeatureFlags';
|
|
7
|
+
export interface CoreModuleShape extends MoldaModuleShape<'core', CoreAction, CoreView, CoreHook> {
|
|
8
|
+
readonly stage: 'initial';
|
|
9
|
+
readonly category: 'platform-core';
|
|
10
|
+
readonly purpose: 'Project identity, locale, time zone, currency, configuration, and feature flags.';
|
|
11
|
+
}
|
|
12
|
+
export type CoreModule = MoldaModuleDefinition<CoreModuleShape>;
|
|
13
|
+
export declare const CoreActionIds: readonly ["updateProjectConfiguration", "setFeatureFlag"];
|
|
14
|
+
export declare const CoreViewIds: readonly ["projectConfiguration", "featureFlags"];
|
|
15
|
+
export declare const CoreHookIds: readonly ["useProjectConfiguration", "useFeatureFlags"];
|
|
16
|
+
export declare const CoreSpecification: {
|
|
17
|
+
readonly id: "core";
|
|
18
|
+
readonly version: "1.0.0";
|
|
19
|
+
readonly collections: {
|
|
20
|
+
readonly 'project-configuration': z.ZodObject<{
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
locale: z.ZodString;
|
|
23
|
+
timeZone: z.ZodString;
|
|
24
|
+
currency: z.ZodString;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
readonly 'feature-flags': z.ZodObject<{
|
|
27
|
+
enabled: z.ZodBoolean;
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
};
|
|
31
|
+
readonly actions: {
|
|
32
|
+
readonly updateProjectConfiguration: {
|
|
33
|
+
readonly kind: "singleton";
|
|
34
|
+
readonly collection: "project-configuration";
|
|
35
|
+
readonly permission: "update.project.configuration";
|
|
36
|
+
readonly event: "update.project.configuration";
|
|
37
|
+
};
|
|
38
|
+
readonly setFeatureFlag: {
|
|
39
|
+
readonly kind: "upsert";
|
|
40
|
+
readonly collection: "feature-flags";
|
|
41
|
+
readonly permission: "set.feature.flag";
|
|
42
|
+
readonly event: "set.feature.flag";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly views: {
|
|
46
|
+
readonly projectConfiguration: {
|
|
47
|
+
readonly kind: "one";
|
|
48
|
+
readonly collection: "project-configuration";
|
|
49
|
+
readonly permission: "project.configuration.read";
|
|
50
|
+
};
|
|
51
|
+
readonly featureFlags: {
|
|
52
|
+
readonly kind: "list";
|
|
53
|
+
readonly collection: "feature-flags";
|
|
54
|
+
readonly permission: "feature.flags.read";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly migrations: readonly [{
|
|
58
|
+
readonly version: 1;
|
|
59
|
+
readonly description: "Create core collections and indexes";
|
|
60
|
+
}];
|
|
61
|
+
readonly fixtures: readonly [{
|
|
62
|
+
readonly id: "core-baseline";
|
|
63
|
+
readonly description: "Deterministic core production-case fixture";
|
|
64
|
+
}];
|
|
65
|
+
};
|
|
66
|
+
export declare const CoreBlueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
|
|
67
|
+
[k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
68
|
+
id: string;
|
|
69
|
+
data: Record<string, unknown>;
|
|
70
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
71
|
+
data: Record<string, unknown>;
|
|
72
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
73
|
+
id: string;
|
|
74
|
+
expectedRevision: number;
|
|
75
|
+
patch: Record<string, unknown>;
|
|
76
|
+
reason?: string | undefined;
|
|
77
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
78
|
+
id: string;
|
|
79
|
+
expectedRevision: number;
|
|
80
|
+
patch: Record<string, unknown>;
|
|
81
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>>;
|
|
82
|
+
}, {
|
|
83
|
+
[k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
84
|
+
id: string;
|
|
85
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
86
|
+
limit: number;
|
|
87
|
+
equals?: Record<string, unknown> | undefined;
|
|
88
|
+
}, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
|
|
89
|
+
}>;
|
|
90
|
+
export declare function createCoreService(repository: ModuleRepository): {
|
|
91
|
+
blueprint: import("@molda-org/module-runtime").ModuleBlueprint<{
|
|
92
|
+
[k: string]: import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
93
|
+
id: string;
|
|
94
|
+
data: Record<string, unknown>;
|
|
95
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
96
|
+
data: Record<string, unknown>;
|
|
97
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
98
|
+
id: string;
|
|
99
|
+
expectedRevision: number;
|
|
100
|
+
patch: Record<string, unknown>;
|
|
101
|
+
reason?: string | undefined;
|
|
102
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleActionDefinition<{
|
|
103
|
+
id: string;
|
|
104
|
+
expectedRevision: number;
|
|
105
|
+
patch: Record<string, unknown>;
|
|
106
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>>;
|
|
107
|
+
}, {
|
|
108
|
+
[k: string]: import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
109
|
+
id: string;
|
|
110
|
+
}, import("@molda-org/module-runtime").ModuleRecord<Readonly<Record<string, unknown>>>> | import("@molda-org/module-runtime").ModuleViewDefinition<{
|
|
111
|
+
limit: number;
|
|
112
|
+
equals?: Record<string, unknown> | undefined;
|
|
113
|
+
}, readonly import("@molda-org/module-runtime").ModuleRecord<Record<string, unknown>>[]>;
|
|
114
|
+
}>;
|
|
115
|
+
executeAction<TKey extends string>(actionId: TKey, unsafeInput: {
|
|
116
|
+
id: string;
|
|
117
|
+
data: Record<string, unknown>;
|
|
118
|
+
} | {
|
|
119
|
+
data: Record<string, unknown>;
|
|
120
|
+
} | {
|
|
121
|
+
id: string;
|
|
122
|
+
expectedRevision: number;
|
|
123
|
+
patch: Record<string, unknown>;
|
|
124
|
+
reason?: string | undefined;
|
|
125
|
+
} | {
|
|
126
|
+
id: string;
|
|
127
|
+
expectedRevision: number;
|
|
128
|
+
patch: Record<string, unknown>;
|
|
129
|
+
}, invocation: import("@molda-org/module-runtime").ModuleActionInvocation): Promise<import("@molda-org/module-runtime").ModuleActionExecution<never>>;
|
|
130
|
+
executeView<TKey extends string>(viewId: TKey, unsafeInput: {
|
|
131
|
+
id: string;
|
|
132
|
+
} | {
|
|
133
|
+
limit: number;
|
|
134
|
+
equals?: Record<string, unknown> | undefined;
|
|
135
|
+
}, context: import("@molda-org/module-runtime").ModuleExecutionContext): Promise<never>;
|
|
136
|
+
};
|
|
137
|
+
export declare function createCoreRuntimeModule(repository: ModuleRepository): import("@molda-org/module-runtime").ResourceModuleContribution;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createResourceModuleContribution, createResourceModuleService, defineResourceModule, } from '@molda-org/module-runtime';
|
|
3
|
+
export const CoreActionIds = ["updateProjectConfiguration", "setFeatureFlag"];
|
|
4
|
+
export const CoreViewIds = ["projectConfiguration", "featureFlags"];
|
|
5
|
+
export const CoreHookIds = ["useProjectConfiguration", "useFeatureFlags"];
|
|
6
|
+
export const CoreSpecification = {
|
|
7
|
+
id: 'core',
|
|
8
|
+
version: '1.0.0',
|
|
9
|
+
collections: {
|
|
10
|
+
'project-configuration': z.object({ name: z.string().min(1).max(120), locale: z.string().min(2).max(35), timeZone: z.string().min(1).max(100), currency: z.string().length(3) }).strict(),
|
|
11
|
+
'feature-flags': z.object({ enabled: z.boolean(), description: z.string().max(500).optional() }).strict(),
|
|
12
|
+
},
|
|
13
|
+
actions: {
|
|
14
|
+
updateProjectConfiguration: { kind: 'singleton', collection: 'project-configuration', permission: 'update.project.configuration', event: 'update.project.configuration' },
|
|
15
|
+
setFeatureFlag: { kind: 'upsert', collection: 'feature-flags', permission: 'set.feature.flag', event: 'set.feature.flag' },
|
|
16
|
+
},
|
|
17
|
+
views: {
|
|
18
|
+
projectConfiguration: { kind: 'one', collection: 'project-configuration', permission: 'project.configuration.read' },
|
|
19
|
+
featureFlags: { kind: 'list', collection: 'feature-flags', permission: 'feature.flags.read' },
|
|
20
|
+
},
|
|
21
|
+
migrations: [{ version: 1, description: 'Create core collections and indexes' }],
|
|
22
|
+
fixtures: [{ id: 'core-baseline', description: 'Deterministic core production-case fixture' }],
|
|
23
|
+
};
|
|
24
|
+
export const CoreBlueprint = defineResourceModule(CoreSpecification);
|
|
25
|
+
export function createCoreService(repository) {
|
|
26
|
+
return createResourceModuleService(CoreSpecification, repository);
|
|
27
|
+
}
|
|
28
|
+
export function createCoreRuntimeModule(repository) {
|
|
29
|
+
return createResourceModuleContribution(CoreSpecification, repository);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC;AAcnC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,4BAA4B,EAAC,gBAAgB,CAAU,CAAC;AACtF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,sBAAsB,EAAC,cAAc,CAAU,CAAC;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,yBAAyB,EAAC,iBAAiB,CAAU,CAAC;AAElF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE;QACX,uBAAuB,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;QACzL,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,CAA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
|
|
4
4
|
"type": "module",
|
|
5
|
-
"types": "./index.d.ts",
|
|
6
5
|
"exports": {
|
|
7
6
|
".": {
|
|
8
|
-
"types": "./index.d.ts"
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"
|
|
12
|
+
"dist"
|
|
13
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"prepack": "npm run build",
|
|
17
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
18
|
+
},
|
|
14
19
|
"dependencies": {
|
|
15
|
-
"@molda-org/module-contracts": "0.1.0-next.
|
|
20
|
+
"@molda-org/module-contracts": "0.1.0-next.10",
|
|
21
|
+
"@molda-org/module-runtime": "0.1.0-next.10",
|
|
22
|
+
"zod": "4.6.5"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "22.19.19",
|
|
26
|
+
"typescript": "5.9.3"
|
|
16
27
|
},
|
|
17
28
|
"publishConfig": {
|
|
18
29
|
"access": "public",
|
package/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { MoldaModuleDefinition, MoldaModuleShape } from '@molda-org/module-contracts';
|
|
2
|
-
|
|
3
|
-
export type CoreAction = 'updateProjectConfiguration' | 'setFeatureFlag';
|
|
4
|
-
export type CoreView = 'projectConfiguration' | 'featureFlags';
|
|
5
|
-
export type CoreHook = 'useProjectConfiguration' | 'useFeatureFlags';
|
|
6
|
-
|
|
7
|
-
export interface CoreModuleShape
|
|
8
|
-
extends MoldaModuleShape<
|
|
9
|
-
'core',
|
|
10
|
-
CoreAction,
|
|
11
|
-
CoreView,
|
|
12
|
-
CoreHook
|
|
13
|
-
> {
|
|
14
|
-
readonly stage: 'initial';
|
|
15
|
-
readonly category: 'platform-core';
|
|
16
|
-
readonly purpose: 'Project identity, locale, time zone, currency, configuration, and feature flags.';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CoreModule = MoldaModuleDefinition<CoreModuleShape>;
|
|
20
|
-
|