@powerhousedao/vetra-builder-package 0.0.16 → 0.0.18
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/document-models/builder-account/gen/document-model.js +1 -1
- package/dist/document-models/builder-account/gen/profile/actions.d.ts +5 -5
- package/dist/document-models/builder-account/gen/profile/creators.d.ts +3 -3
- package/dist/document-models/builder-account/gen/profile/creators.js +1 -1
- package/dist/document-models/builder-account/gen/profile/object.d.ts +2 -2
- package/dist/document-models/builder-account/gen/profile/object.js +3 -3
- package/dist/document-models/builder-account/gen/profile/operations.d.ts +2 -2
- package/dist/document-models/builder-account/gen/reducer.js +3 -3
- package/dist/document-models/builder-account/gen/schema/types.d.ts +1 -1
- package/dist/document-models/builder-account/gen/schema/zod.js +1 -1
- package/dist/document-models/builder-account/index.d.ts +1 -1
- package/dist/document-models/builder-account/src/reducers/profile.js +4 -0
- package/dist/document-models/builder-team/gen/actions.d.ts +9 -0
- package/dist/document-models/builder-team/gen/actions.js +4 -0
- package/dist/document-models/builder-team/gen/creators.d.ts +4 -0
- package/dist/document-models/builder-team/gen/creators.js +4 -0
- package/dist/document-models/builder-team/gen/document-model.d.ts +2 -0
- package/dist/document-models/builder-team/gen/document-model.js +212 -0
- package/dist/document-models/builder-team/gen/index.d.ts +7 -0
- package/dist/document-models/builder-team/gen/index.js +6 -0
- package/dist/document-models/builder-team/gen/member/actions.d.ts +15 -0
- package/dist/document-models/builder-team/gen/member/actions.js +1 -0
- package/dist/document-models/builder-team/gen/member/creators.d.ts +5 -0
- package/dist/document-models/builder-team/gen/member/creators.js +5 -0
- package/dist/document-models/builder-team/gen/member/error.d.ts +1 -0
- package/dist/document-models/builder-team/gen/member/error.js +1 -0
- package/dist/document-models/builder-team/gen/member/object.d.ts +8 -0
- package/dist/document-models/builder-team/gen/member/object.js +13 -0
- package/dist/document-models/builder-team/gen/member/operations.d.ts +8 -0
- package/dist/document-models/builder-team/gen/member/operations.js +1 -0
- package/dist/document-models/builder-team/gen/object.d.ts +20 -0
- package/dist/document-models/builder-team/gen/object.js +36 -0
- package/dist/document-models/builder-team/gen/packages/actions.d.ts +15 -0
- package/dist/document-models/builder-team/gen/packages/actions.js +1 -0
- package/dist/document-models/builder-team/gen/packages/creators.d.ts +5 -0
- package/dist/document-models/builder-team/gen/packages/creators.js +5 -0
- package/dist/document-models/builder-team/gen/packages/error.d.ts +1 -0
- package/dist/document-models/builder-team/gen/packages/error.js +1 -0
- package/dist/document-models/builder-team/gen/packages/object.d.ts +8 -0
- package/dist/document-models/builder-team/gen/packages/object.js +13 -0
- package/dist/document-models/builder-team/gen/packages/operations.d.ts +8 -0
- package/dist/document-models/builder-team/gen/packages/operations.js +1 -0
- package/dist/document-models/builder-team/gen/ph-factories.d.ts +26 -0
- package/dist/document-models/builder-team/gen/ph-factories.js +62 -0
- package/dist/document-models/builder-team/gen/profile/actions.d.ts +23 -0
- package/dist/document-models/builder-team/gen/profile/actions.js +1 -0
- package/dist/document-models/builder-team/gen/profile/creators.d.ts +7 -0
- package/dist/document-models/builder-team/gen/profile/creators.js +7 -0
- package/dist/document-models/builder-team/gen/profile/error.d.ts +1 -0
- package/dist/document-models/builder-team/gen/profile/error.js +1 -0
- package/dist/document-models/builder-team/gen/profile/object.d.ts +10 -0
- package/dist/document-models/builder-team/gen/profile/object.js +19 -0
- package/dist/document-models/builder-team/gen/profile/operations.d.ts +10 -0
- package/dist/document-models/builder-team/gen/profile/operations.js +1 -0
- package/dist/document-models/builder-team/gen/reducer.d.ts +4 -0
- package/dist/document-models/builder-team/gen/reducer.js +75 -0
- package/dist/document-models/builder-team/gen/schema/index.d.ts +2 -0
- package/dist/document-models/builder-team/gen/schema/index.js +2 -0
- package/dist/document-models/builder-team/gen/schema/types.d.ts +247 -0
- package/dist/document-models/builder-team/gen/schema/types.js +1 -0
- package/dist/document-models/builder-team/gen/schema/zod.d.ts +29 -0
- package/dist/document-models/builder-team/gen/schema/zod.js +148 -0
- package/dist/document-models/builder-team/gen/spaces/actions.d.ts +15 -0
- package/dist/document-models/builder-team/gen/spaces/actions.js +1 -0
- package/dist/document-models/builder-team/gen/spaces/creators.d.ts +5 -0
- package/dist/document-models/builder-team/gen/spaces/creators.js +5 -0
- package/dist/document-models/builder-team/gen/spaces/error.d.ts +1 -0
- package/dist/document-models/builder-team/gen/spaces/error.js +1 -0
- package/dist/document-models/builder-team/gen/spaces/object.d.ts +8 -0
- package/dist/document-models/builder-team/gen/spaces/object.js +13 -0
- package/dist/document-models/builder-team/gen/spaces/operations.d.ts +8 -0
- package/dist/document-models/builder-team/gen/spaces/operations.js +1 -0
- package/dist/document-models/builder-team/gen/types.d.ts +9 -0
- package/dist/document-models/builder-team/gen/types.js +1 -0
- package/dist/document-models/builder-team/gen/utils.d.ts +21 -0
- package/dist/document-models/builder-team/gen/utils.js +54 -0
- package/dist/document-models/builder-team/index.d.ts +37 -0
- package/dist/document-models/builder-team/index.js +21 -0
- package/dist/document-models/builder-team/src/reducers/member.d.ts +2 -0
- package/dist/document-models/builder-team/src/reducers/member.js +30 -0
- package/dist/document-models/builder-team/src/reducers/packages.d.ts +2 -0
- package/dist/document-models/builder-team/src/reducers/packages.js +40 -0
- package/dist/document-models/builder-team/src/reducers/profile.d.ts +2 -0
- package/dist/document-models/builder-team/src/reducers/profile.js +26 -0
- package/dist/document-models/builder-team/src/reducers/spaces.d.ts +2 -0
- package/dist/document-models/builder-team/src/reducers/spaces.js +34 -0
- package/dist/document-models/builder-team/src/tests/document-model.test.d.ts +5 -0
- package/dist/document-models/builder-team/src/tests/document-model.test.js +18 -0
- package/dist/document-models/builder-team/src/tests/member.test.d.ts +5 -0
- package/dist/document-models/builder-team/src/tests/member.test.js +40 -0
- package/dist/document-models/builder-team/src/tests/packages.test.d.ts +5 -0
- package/dist/document-models/builder-team/src/tests/packages.test.js +40 -0
- package/dist/document-models/builder-team/src/tests/profile.test.d.ts +5 -0
- package/dist/document-models/builder-team/src/tests/profile.test.js +56 -0
- package/dist/document-models/builder-team/src/tests/spaces.test.d.ts +5 -0
- package/dist/document-models/builder-team/src/tests/spaces.test.js +40 -0
- package/dist/document-models/builder-team/src/utils.d.ts +1 -0
- package/dist/document-models/builder-team/src/utils.js +1 -0
- package/dist/document-models/index.d.ts +1 -2
- package/dist/document-models/index.js +1 -2
- package/dist/editors/builder-team-editor/components/Header.d.ts +8 -0
- package/dist/editors/builder-team-editor/components/Header.js +5 -0
- package/dist/editors/builder-team-editor/components/MembersSection.d.ts +14 -0
- package/dist/editors/builder-team-editor/components/MembersSection.js +152 -0
- package/dist/editors/builder-team-editor/components/PackageForm.d.ts +8 -0
- package/dist/editors/builder-team-editor/components/PackageForm.js +92 -0
- package/dist/editors/builder-team-editor/components/PackageItem.d.ts +11 -0
- package/dist/editors/builder-team-editor/components/PackageItem.js +99 -0
- package/dist/editors/builder-team-editor/components/ProfileSection.d.ts +17 -0
- package/dist/editors/builder-team-editor/components/ProfileSection.js +5 -0
- package/dist/editors/builder-team-editor/components/QuickStats.d.ts +7 -0
- package/dist/editors/builder-team-editor/components/QuickStats.js +5 -0
- package/dist/editors/builder-team-editor/components/SpaceForm.d.ts +9 -0
- package/dist/editors/builder-team-editor/components/SpaceForm.js +11 -0
- package/dist/editors/builder-team-editor/components/SpaceItem.d.ts +21 -0
- package/dist/editors/builder-team-editor/components/SpaceItem.js +12 -0
- package/dist/editors/builder-team-editor/components/SpacesSection.d.ts +22 -0
- package/dist/editors/builder-team-editor/components/SpacesSection.js +14 -0
- package/dist/editors/builder-team-editor/config.d.ts +6 -0
- package/dist/editors/builder-team-editor/config.js +11 -0
- package/dist/editors/builder-team-editor/editor.d.ts +3 -0
- package/dist/editors/builder-team-editor/editor.js +73 -0
- package/dist/editors/builder-team-editor/hooks/useMemberHandlers.d.ts +12 -0
- package/dist/editors/builder-team-editor/hooks/useMemberHandlers.js +27 -0
- package/dist/editors/builder-team-editor/hooks/usePackageHandlers.d.ts +11 -0
- package/dist/editors/builder-team-editor/hooks/usePackageHandlers.js +49 -0
- package/dist/editors/builder-team-editor/hooks/useProfileHandlers.d.ts +14 -0
- package/dist/editors/builder-team-editor/hooks/useProfileHandlers.js +38 -0
- package/dist/editors/builder-team-editor/hooks/useSpaceHandlers.d.ts +15 -0
- package/dist/editors/builder-team-editor/hooks/useSpaceHandlers.js +82 -0
- package/dist/editors/builder-team-editor/index.d.ts +2 -0
- package/dist/editors/builder-team-editor/index.js +11 -0
- package/dist/editors/hooks/useBuilderTeamDocument.d.ts +3 -0
- package/dist/editors/hooks/useBuilderTeamDocument.js +8 -0
- package/dist/editors/index.d.ts +1 -2
- package/dist/editors/index.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/powerhouse.manifest.json +21 -6
- package/dist/processors/factory.d.ts +0 -4
- package/dist/processors/factory.js +6 -4
- package/dist/processors/index.d.ts +2 -4
- package/dist/processors/index.js +2 -4
- package/dist/processors/old_vetra-builder-relational-db-processor/factory.d.ts +3 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/factory.js +22 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/index.d.ts +9 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/index.js +32 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/migrations.d.ts +3 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/migrations.js +14 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/schema.d.ts +7 -0
- package/dist/processors/old_vetra-builder-relational-db-processor/schema.js +1 -0
- package/dist/processors/vetra-builder-read-model/builder-account-handlers.d.ts +27 -0
- package/dist/processors/vetra-builder-read-model/builder-account-handlers.js +249 -0
- package/dist/processors/vetra-builder-read-model/database-helpers.d.ts +39 -0
- package/dist/processors/vetra-builder-read-model/database-helpers.js +144 -0
- package/dist/processors/vetra-builder-read-model/factory.d.ts +3 -0
- package/dist/processors/vetra-builder-read-model/factory.js +25 -0
- package/dist/processors/vetra-builder-read-model/index.d.ts +29 -0
- package/dist/processors/vetra-builder-read-model/index.js +370 -0
- package/dist/processors/vetra-builder-read-model/migrations.d.ts +3 -0
- package/dist/processors/vetra-builder-read-model/migrations.js +152 -0
- package/dist/processors/vetra-builder-read-model/package-handlers.d.ts +20 -0
- package/dist/processors/vetra-builder-read-model/package-handlers.js +116 -0
- package/dist/processors/vetra-builder-read-model/schema.d.ts +66 -0
- package/dist/processors/vetra-builder-read-model/schema.js +1 -0
- package/dist/processors/vetra-builder-read-model/types.d.ts +32 -0
- package/dist/processors/vetra-builder-read-model/types.js +1 -0
- package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.d.ts +22 -0
- package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.js +261 -0
- package/dist/processors/vetra-builder-relational-db-processor/database-helpers.d.ts +39 -0
- package/dist/processors/vetra-builder-relational-db-processor/database-helpers.js +144 -0
- package/dist/processors/vetra-builder-relational-db-processor/factory.d.ts +3 -0
- package/dist/processors/vetra-builder-relational-db-processor/factory.js +23 -0
- package/dist/processors/vetra-builder-relational-db-processor/index.d.ts +13 -0
- package/dist/processors/vetra-builder-relational-db-processor/index.js +53 -0
- package/dist/processors/vetra-builder-relational-db-processor/migrations.d.ts +3 -0
- package/dist/processors/vetra-builder-relational-db-processor/migrations.js +155 -0
- package/dist/processors/vetra-builder-relational-db-processor/schema.d.ts +66 -0
- package/dist/processors/vetra-builder-relational-db-processor/schema.js +1 -0
- package/dist/processors/vetra-builder-relational-db-processor/types.d.ts +32 -0
- package/dist/processors/vetra-builder-relational-db-processor/types.js +1 -0
- package/dist/style.css +28 -200
- package/dist/subgraphs/builder-account/resolvers.js +3 -3
- package/dist/subgraphs/builder-account/schema.js +4 -4
- package/dist/subgraphs/builder-team/index.d.ts +10 -0
- package/dist/subgraphs/builder-team/index.js +11 -0
- package/dist/subgraphs/builder-team/resolvers.d.ts +2 -0
- package/dist/subgraphs/builder-team/resolvers.js +240 -0
- package/dist/subgraphs/builder-team/schema.d.ts +2 -0
- package/dist/subgraphs/builder-team/schema.js +228 -0
- package/dist/subgraphs/index.d.ts +2 -3
- package/dist/subgraphs/index.js +3 -4
- package/dist/subgraphs/vetra-builder-read-model/index.d.ts +1 -1
- package/dist/subgraphs/vetra-builder-read-model/index.js +1 -1
- package/dist/subgraphs/vetra-builder-read-model/resolvers.js +7 -7
- package/dist/subgraphs/vetra-builders/index.d.ts +10 -0
- package/dist/subgraphs/vetra-builders/index.js +11 -0
- package/dist/subgraphs/vetra-builders/resolvers.d.ts +2 -0
- package/dist/subgraphs/vetra-builders/resolvers.js +144 -0
- package/dist/subgraphs/vetra-builders/schema.d.ts +2 -0
- package/dist/subgraphs/vetra-builders/schema.js +79 -0
- package/dist/subgraphs/vetra-builders-bkp/index.d.ts +10 -0
- package/dist/subgraphs/vetra-builders-bkp/index.js +11 -0
- package/dist/subgraphs/vetra-builders-bkp/resolvers.d.ts +2 -0
- package/dist/subgraphs/vetra-builders-bkp/resolvers.js +10 -0
- package/dist/subgraphs/vetra-builders-bkp/schema.d.ts +2 -0
- package/dist/subgraphs/vetra-builders-bkp/schema.js +9 -0
- package/dist/utils/nano-id.d.ts +1 -0
- package/dist/utils/nano-id.js +4 -0
- package/package.json +4 -2
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
|
|
3
|
+
export const definedNonNullAnySchema = z
|
|
4
|
+
.any()
|
|
5
|
+
.refine((v) => isDefinedNonNullAny(v));
|
|
6
|
+
export function AddMemberInputSchema() {
|
|
7
|
+
return z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export function AddPackageInputSchema() {
|
|
12
|
+
return z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
spaceId: z.string(),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function AddSpaceInputSchema() {
|
|
18
|
+
return z.object({
|
|
19
|
+
id: z.string(),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function BuilderTeamStateSchema() {
|
|
23
|
+
return z.object({
|
|
24
|
+
__typename: z.literal("BuilderTeamState").optional(),
|
|
25
|
+
members: z.array(RenownProfileInfoSchema()),
|
|
26
|
+
profile: VetraBuilderProfileSchema(),
|
|
27
|
+
spaces: z.array(VetraBuilderSpaceSchema()),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function RemoveMemberInputSchema() {
|
|
31
|
+
return z.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function RemovePackageInputSchema() {
|
|
36
|
+
return z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function RemoveSpaceInputSchema() {
|
|
41
|
+
return z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function RenownProfileInfoSchema() {
|
|
46
|
+
return z.object({
|
|
47
|
+
__typename: z.literal("RenownProfileInfo").optional(),
|
|
48
|
+
ethAddress: z.string().nullable(),
|
|
49
|
+
id: z.string(),
|
|
50
|
+
name: z.string().nullable(),
|
|
51
|
+
phid: z.string().nullable(),
|
|
52
|
+
profileImage: z.string().nullable(),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function SetDescriptionInputSchema() {
|
|
56
|
+
return z.object({
|
|
57
|
+
description: z.string().nullish(),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function SetLogoInputSchema() {
|
|
61
|
+
return z.object({
|
|
62
|
+
logo: z.string().nullish(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function SetSlugInputSchema() {
|
|
66
|
+
return z.object({
|
|
67
|
+
slug: z.string(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function SetSocialsInputSchema() {
|
|
71
|
+
return z.object({
|
|
72
|
+
github: z.string().nullish(),
|
|
73
|
+
website: z.string().nullish(),
|
|
74
|
+
xProfile: z.string().nullish(),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export function SetTeamNameInputSchema() {
|
|
78
|
+
return z.object({
|
|
79
|
+
name: z.string(),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function UpdateMemberInfoInputSchema() {
|
|
83
|
+
return z.object({
|
|
84
|
+
ethAddress: z.string().nullish(),
|
|
85
|
+
id: z.string(),
|
|
86
|
+
name: z.string().nullish(),
|
|
87
|
+
phid: z.string().nullish(),
|
|
88
|
+
profileImage: z.string().nullish(),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export function UpdatePackageInfoInputSchema() {
|
|
92
|
+
return z.object({
|
|
93
|
+
description: z.string().nullish(),
|
|
94
|
+
github: z.string().nullish(),
|
|
95
|
+
id: z.string(),
|
|
96
|
+
npm: z.string().nullish(),
|
|
97
|
+
phid: z.string().nullish(),
|
|
98
|
+
spaceId: z.string().nullish(),
|
|
99
|
+
title: z.string().nullish(),
|
|
100
|
+
vetraDriveUrl: z.string().url().nullish(),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
export function UpdateSpaceInfoInputSchema() {
|
|
104
|
+
return z.object({
|
|
105
|
+
description: z.string().nullish(),
|
|
106
|
+
id: z.string(),
|
|
107
|
+
title: z.string().nullish(),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export function VetraBuilderProfileSchema() {
|
|
111
|
+
return z.object({
|
|
112
|
+
__typename: z.literal("VetraBuilderProfile").optional(),
|
|
113
|
+
description: z.string().nullable(),
|
|
114
|
+
logo: z.string().url().nullable(),
|
|
115
|
+
name: z.string(),
|
|
116
|
+
slug: z.string(),
|
|
117
|
+
socials: VetraBuilderSocialsSchema(),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export function VetraBuilderSocialsSchema() {
|
|
121
|
+
return z.object({
|
|
122
|
+
__typename: z.literal("VetraBuilderSocials").optional(),
|
|
123
|
+
github: z.string().url().nullable(),
|
|
124
|
+
website: z.string().url().nullable(),
|
|
125
|
+
xProfile: z.string().url().nullable(),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export function VetraBuilderSpaceSchema() {
|
|
129
|
+
return z.object({
|
|
130
|
+
__typename: z.literal("VetraBuilderSpace").optional(),
|
|
131
|
+
description: z.string().nullable(),
|
|
132
|
+
id: z.string(),
|
|
133
|
+
packages: z.array(VetraPackageInfoSchema()),
|
|
134
|
+
title: z.string(),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export function VetraPackageInfoSchema() {
|
|
138
|
+
return z.object({
|
|
139
|
+
__typename: z.literal("VetraPackageInfo").optional(),
|
|
140
|
+
description: z.string().nullable(),
|
|
141
|
+
github: z.string().nullable(),
|
|
142
|
+
id: z.string(),
|
|
143
|
+
npm: z.string().nullable(),
|
|
144
|
+
phid: z.string().nullable(),
|
|
145
|
+
title: z.string().nullable(),
|
|
146
|
+
vetraDriveUrl: z.string().url().nullable(),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Action } from "document-model";
|
|
2
|
+
import type { AddSpaceInput, UpdateSpaceInfoInput, RemoveSpaceInput } from "../types.js";
|
|
3
|
+
export type AddSpaceAction = Action & {
|
|
4
|
+
type: "ADD_SPACE";
|
|
5
|
+
input: AddSpaceInput;
|
|
6
|
+
};
|
|
7
|
+
export type UpdateSpaceInfoAction = Action & {
|
|
8
|
+
type: "UPDATE_SPACE_INFO";
|
|
9
|
+
input: UpdateSpaceInfoInput;
|
|
10
|
+
};
|
|
11
|
+
export type RemoveSpaceAction = Action & {
|
|
12
|
+
type: "REMOVE_SPACE";
|
|
13
|
+
input: RemoveSpaceInput;
|
|
14
|
+
};
|
|
15
|
+
export type BuilderTeamSpacesAction = AddSpaceAction | UpdateSpaceInfoAction | RemoveSpaceAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type AddSpaceInput, type UpdateSpaceInfoInput, type RemoveSpaceInput } from "../types.js";
|
|
2
|
+
import { type AddSpaceAction, type UpdateSpaceInfoAction, type RemoveSpaceAction } from "./actions.js";
|
|
3
|
+
export declare const addSpace: (input: AddSpaceInput) => AddSpaceAction;
|
|
4
|
+
export declare const updateSpaceInfo: (input: UpdateSpaceInfoInput) => UpdateSpaceInfoAction;
|
|
5
|
+
export declare const removeSpace: (input: RemoveSpaceInput) => RemoveSpaceAction;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createAction } from "document-model";
|
|
2
|
+
import { z, } from "../types.js";
|
|
3
|
+
export const addSpace = (input) => createAction("ADD_SPACE", { ...input }, undefined, z.AddSpaceInputSchema, "global");
|
|
4
|
+
export const updateSpaceInfo = (input) => createAction("UPDATE_SPACE_INFO", { ...input }, undefined, z.UpdateSpaceInfoInputSchema, "global");
|
|
5
|
+
export const removeSpace = (input) => createAction("REMOVE_SPACE", { ...input }, undefined, z.RemoveSpaceInputSchema, "global");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const errors: {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const errors = {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseDocumentClass } from "document-model";
|
|
2
|
+
import { type BuilderTeamPHState } from "../ph-factories.js";
|
|
3
|
+
import { type AddSpaceInput, type UpdateSpaceInfoInput, type RemoveSpaceInput } from "../types.js";
|
|
4
|
+
export default class BuilderTeam_Spaces extends BaseDocumentClass<BuilderTeamPHState> {
|
|
5
|
+
addSpace(input: AddSpaceInput): this;
|
|
6
|
+
updateSpaceInfo(input: UpdateSpaceInfoInput): this;
|
|
7
|
+
removeSpace(input: RemoveSpaceInput): this;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseDocumentClass } from "document-model";
|
|
2
|
+
import { addSpace, updateSpaceInfo, removeSpace } from "./creators.js";
|
|
3
|
+
export default class BuilderTeam_Spaces extends BaseDocumentClass {
|
|
4
|
+
addSpace(input) {
|
|
5
|
+
return this.dispatch(addSpace(input));
|
|
6
|
+
}
|
|
7
|
+
updateSpaceInfo(input) {
|
|
8
|
+
return this.dispatch(updateSpaceInfo(input));
|
|
9
|
+
}
|
|
10
|
+
removeSpace(input) {
|
|
11
|
+
return this.dispatch(removeSpace(input));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SignalDispatch } from "document-model";
|
|
2
|
+
import { type AddSpaceAction, type UpdateSpaceInfoAction, type RemoveSpaceAction } from "./actions.js";
|
|
3
|
+
import { type BuilderTeamState } from "../types.js";
|
|
4
|
+
export interface BuilderTeamSpacesOperations {
|
|
5
|
+
addSpaceOperation: (state: BuilderTeamState, action: AddSpaceAction, dispatch?: SignalDispatch) => void;
|
|
6
|
+
updateSpaceInfoOperation: (state: BuilderTeamState, action: UpdateSpaceInfoAction, dispatch?: SignalDispatch) => void;
|
|
7
|
+
removeSpaceOperation: (state: BuilderTeamState, action: RemoveSpaceAction, dispatch?: SignalDispatch) => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PHDocument } from "document-model";
|
|
2
|
+
import type { BuilderTeamAction } from "./actions.js";
|
|
3
|
+
import type { BuilderTeamPHState } from "./ph-factories.js";
|
|
4
|
+
import type { BuilderTeamState } from "./schema/types.js";
|
|
5
|
+
export { z } from "./schema/index.js";
|
|
6
|
+
export type * from "./schema/types.js";
|
|
7
|
+
type BuilderTeamLocalState = Record<PropertyKey, never>;
|
|
8
|
+
export type BuilderTeamDocument = PHDocument<BuilderTeamPHState>;
|
|
9
|
+
export type { BuilderTeamState, BuilderTeamLocalState, BuilderTeamAction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { z } from "./schema/index.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CreateDocument, type CreateState, type LoadFromFile, type LoadFromInput } from "document-model";
|
|
2
|
+
import { type BuilderTeamState, type BuilderTeamLocalState } from "./types.js";
|
|
3
|
+
import { type BuilderTeamPHState } from "./ph-factories.js";
|
|
4
|
+
export declare const initialGlobalState: BuilderTeamState;
|
|
5
|
+
export declare const initialLocalState: BuilderTeamLocalState;
|
|
6
|
+
export declare const createState: CreateState<BuilderTeamPHState>;
|
|
7
|
+
export declare const createDocument: CreateDocument<BuilderTeamPHState>;
|
|
8
|
+
export declare const saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
9
|
+
export declare const saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
10
|
+
export declare const loadFromFile: LoadFromFile<BuilderTeamPHState>;
|
|
11
|
+
export declare const loadFromInput: LoadFromInput<BuilderTeamPHState>;
|
|
12
|
+
declare const utils: {
|
|
13
|
+
fileExtension: string;
|
|
14
|
+
createState: CreateState<BuilderTeamPHState>;
|
|
15
|
+
createDocument: CreateDocument<BuilderTeamPHState>;
|
|
16
|
+
saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
17
|
+
saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
18
|
+
loadFromFile: LoadFromFile<BuilderTeamPHState>;
|
|
19
|
+
loadFromInput: LoadFromInput<BuilderTeamPHState>;
|
|
20
|
+
};
|
|
21
|
+
export default utils;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { baseCreateDocument, baseSaveToFile, baseSaveToFileHandle, baseLoadFromFile, baseLoadFromInput, defaultBaseState, generateId, } from "document-model";
|
|
2
|
+
import { reducer } from "./reducer.js";
|
|
3
|
+
export const initialGlobalState = {
|
|
4
|
+
profile: {
|
|
5
|
+
logo: null,
|
|
6
|
+
name: "",
|
|
7
|
+
slug: "",
|
|
8
|
+
description: null,
|
|
9
|
+
socials: {
|
|
10
|
+
xProfile: null,
|
|
11
|
+
github: null,
|
|
12
|
+
website: null,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
members: [],
|
|
16
|
+
spaces: [],
|
|
17
|
+
};
|
|
18
|
+
export const initialLocalState = {};
|
|
19
|
+
export const createState = (state) => {
|
|
20
|
+
return {
|
|
21
|
+
...defaultBaseState(),
|
|
22
|
+
global: { ...initialGlobalState, ...(state?.global ?? {}) },
|
|
23
|
+
local: { ...initialLocalState, ...(state?.local ?? {}) },
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export const createDocument = (state) => {
|
|
27
|
+
const document = baseCreateDocument(createState, state);
|
|
28
|
+
document.header.documentType = "powerhouse/builder-team";
|
|
29
|
+
// for backwards compatibility, but this is NOT a valid signed document id
|
|
30
|
+
document.header.id = generateId();
|
|
31
|
+
return document;
|
|
32
|
+
};
|
|
33
|
+
export const saveToFile = (document, path, name) => {
|
|
34
|
+
return baseSaveToFile(document, path, "phvba", name);
|
|
35
|
+
};
|
|
36
|
+
export const saveToFileHandle = (document, input) => {
|
|
37
|
+
return baseSaveToFileHandle(document, input);
|
|
38
|
+
};
|
|
39
|
+
export const loadFromFile = (path) => {
|
|
40
|
+
return baseLoadFromFile(path, reducer);
|
|
41
|
+
};
|
|
42
|
+
export const loadFromInput = (input) => {
|
|
43
|
+
return baseLoadFromInput(input, reducer);
|
|
44
|
+
};
|
|
45
|
+
const utils = {
|
|
46
|
+
fileExtension: "phvba",
|
|
47
|
+
createState,
|
|
48
|
+
createDocument,
|
|
49
|
+
saveToFile,
|
|
50
|
+
saveToFileHandle,
|
|
51
|
+
loadFromFile,
|
|
52
|
+
loadFromInput,
|
|
53
|
+
};
|
|
54
|
+
export default utils;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization.
|
|
3
|
+
* Delete the file and run the code generator again to have it reset
|
|
4
|
+
*/
|
|
5
|
+
import { type DocumentModelModule } from "document-model";
|
|
6
|
+
import { reducer } from "./gen/reducer.js";
|
|
7
|
+
import { documentModel } from "./gen/document-model.js";
|
|
8
|
+
import type { BuilderTeamPHState } from "./gen/ph-factories.js";
|
|
9
|
+
declare const utils: {
|
|
10
|
+
fileExtension: string;
|
|
11
|
+
createState: import("document-model").CreateState<BuilderTeamPHState>;
|
|
12
|
+
createDocument: import("document-model").CreateDocument<BuilderTeamPHState>;
|
|
13
|
+
saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
14
|
+
saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
15
|
+
loadFromFile: import("document-model").LoadFromFile<BuilderTeamPHState>;
|
|
16
|
+
loadFromInput: import("document-model").LoadFromInput<BuilderTeamPHState>;
|
|
17
|
+
};
|
|
18
|
+
declare const actions: {
|
|
19
|
+
setLogo: (input: import("./index.js").SetLogoInput) => import("./gen/actions.js").SetLogoAction;
|
|
20
|
+
setTeamName: (input: import("./index.js").SetTeamNameInput) => import("./gen/actions.js").SetTeamNameAction;
|
|
21
|
+
setSlug: (input: import("./index.js").SetSlugInput) => import("./gen/actions.js").SetSlugAction;
|
|
22
|
+
setDescription: (input: import("./index.js").SetDescriptionInput) => import("./gen/actions.js").SetDescriptionAction;
|
|
23
|
+
setSocials: (input: import("./index.js").SetSocialsInput) => import("./gen/actions.js").SetSocialsAction;
|
|
24
|
+
addMember: (input: import("./index.js").AddMemberInput) => import("./gen/actions.js").AddMemberAction;
|
|
25
|
+
updateMemberInfo: (input: import("./index.js").UpdateMemberInfoInput) => import("./gen/actions.js").UpdateMemberInfoAction;
|
|
26
|
+
removeMember: (input: import("./index.js").RemoveMemberInput) => import("./gen/actions.js").RemoveMemberAction;
|
|
27
|
+
addSpace: (input: import("./index.js").AddSpaceInput) => import("./gen/actions.js").AddSpaceAction;
|
|
28
|
+
updateSpaceInfo: (input: import("./index.js").UpdateSpaceInfoInput) => import("./gen/actions.js").UpdateSpaceInfoAction;
|
|
29
|
+
removeSpace: (input: import("./index.js").RemoveSpaceInput) => import("./gen/actions.js").RemoveSpaceAction;
|
|
30
|
+
addPackage: (input: import("./index.js").AddPackageInput) => import("./gen/actions.js").AddPackageAction;
|
|
31
|
+
updatePackageInfo: (input: import("./index.js").UpdatePackageInfoInput) => import("./gen/actions.js").UpdatePackageInfoAction;
|
|
32
|
+
removePackage: (input: import("./index.js").RemovePackageInput) => import("./gen/actions.js").RemovePackageAction;
|
|
33
|
+
};
|
|
34
|
+
export declare const module: DocumentModelModule<BuilderTeamPHState>;
|
|
35
|
+
export { reducer, actions, utils, documentModel };
|
|
36
|
+
export * from "./gen/types.js";
|
|
37
|
+
export * from "./src/utils.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization.
|
|
3
|
+
* Delete the file and run the code generator again to have it reset
|
|
4
|
+
*/
|
|
5
|
+
import { actions as BaseActions, } from "document-model";
|
|
6
|
+
import { actions as BuilderTeamActions } from "./gen/index.js";
|
|
7
|
+
import { reducer } from "./gen/reducer.js";
|
|
8
|
+
import { documentModel } from "./gen/document-model.js";
|
|
9
|
+
import genUtils from "./gen/utils.js";
|
|
10
|
+
import * as customUtils from "./src/utils.js";
|
|
11
|
+
const utils = { ...genUtils, ...customUtils };
|
|
12
|
+
const actions = { ...BaseActions, ...BuilderTeamActions };
|
|
13
|
+
export const module = {
|
|
14
|
+
reducer,
|
|
15
|
+
actions,
|
|
16
|
+
utils,
|
|
17
|
+
documentModel,
|
|
18
|
+
};
|
|
19
|
+
export { reducer, actions, utils, documentModel };
|
|
20
|
+
export * from "./gen/types.js";
|
|
21
|
+
export * from "./src/utils.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const reducer = {
|
|
2
|
+
addMemberOperation(state, action, dispatch) {
|
|
3
|
+
if (state.members.find((member) => member.id === action.input.id)) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const newMember = {
|
|
7
|
+
...action.input,
|
|
8
|
+
id: action.input.id,
|
|
9
|
+
phid: null,
|
|
10
|
+
ethAddress: null,
|
|
11
|
+
name: null,
|
|
12
|
+
profileImage: null,
|
|
13
|
+
};
|
|
14
|
+
state.members.push(newMember);
|
|
15
|
+
},
|
|
16
|
+
updateMemberInfoOperation(state, action, dispatch) {
|
|
17
|
+
const memberIndex = state.members.findIndex((member) => member.id === action.input.id);
|
|
18
|
+
if (memberIndex === -1) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
state.members[memberIndex] = { ...state.members[memberIndex], ...action.input };
|
|
22
|
+
},
|
|
23
|
+
removeMemberOperation(state, action, dispatch) {
|
|
24
|
+
const memberIndex = state.members.findIndex((member) => member.id === action.input.id);
|
|
25
|
+
if (memberIndex === -1) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
state.members.splice(memberIndex, 1);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const reducer = {
|
|
2
|
+
addPackageOperation(state, action, dispatch) {
|
|
3
|
+
const space = state.spaces.find((space) => space.id === action.input.spaceId);
|
|
4
|
+
if (!space) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const newPackage = {
|
|
8
|
+
...action.input,
|
|
9
|
+
id: action.input.id,
|
|
10
|
+
phid: null,
|
|
11
|
+
title: null,
|
|
12
|
+
description: null,
|
|
13
|
+
github: null,
|
|
14
|
+
npm: null,
|
|
15
|
+
vetraDriveUrl: null,
|
|
16
|
+
};
|
|
17
|
+
space.packages.push(newPackage);
|
|
18
|
+
},
|
|
19
|
+
updatePackageInfoOperation(state, action, dispatch) {
|
|
20
|
+
let packageIndex = -1;
|
|
21
|
+
const spaceIndex = state.spaces.findIndex((space) => {
|
|
22
|
+
packageIndex = space.packages.findIndex((p) => p.id === action.input.id);
|
|
23
|
+
return packageIndex !== -1;
|
|
24
|
+
});
|
|
25
|
+
if (packageIndex === -1) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
state.spaces[spaceIndex].packages[packageIndex] = {
|
|
29
|
+
...state.spaces[spaceIndex].packages[packageIndex],
|
|
30
|
+
...action.input,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
removePackageOperation(state, action, dispatch) {
|
|
34
|
+
const spaceIndex = state.spaces.findIndex((space) => space.packages.find((p) => p.id === action.input.id));
|
|
35
|
+
if (spaceIndex === -1) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
state.spaces[spaceIndex].packages = state.spaces[spaceIndex].packages.filter((p) => p.id !== action.input.id);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const reducer = {
|
|
2
|
+
setLogoOperation(state, action, dispatch) {
|
|
3
|
+
const { logo } = action.input;
|
|
4
|
+
state.profile.logo = logo ?? state.profile.logo;
|
|
5
|
+
},
|
|
6
|
+
setTeamNameOperation(state, action, dispatch) {
|
|
7
|
+
const { name } = action.input;
|
|
8
|
+
state.profile.name = name ?? state.profile.name;
|
|
9
|
+
},
|
|
10
|
+
setSlugOperation(state, action, dispatch) {
|
|
11
|
+
const { slug } = action.input;
|
|
12
|
+
state.profile.slug = slug;
|
|
13
|
+
},
|
|
14
|
+
setDescriptionOperation(state, action, dispatch) {
|
|
15
|
+
const { description } = action.input;
|
|
16
|
+
state.profile.description = description ?? state.profile.description;
|
|
17
|
+
},
|
|
18
|
+
setSocialsOperation(state, action, dispatch) {
|
|
19
|
+
const { github, website, xProfile } = action.input;
|
|
20
|
+
state.profile.socials = {
|
|
21
|
+
github: github ?? state.profile.socials.github,
|
|
22
|
+
website: website ?? state.profile.socials.website,
|
|
23
|
+
xProfile: xProfile ?? state.profile.socials.xProfile,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const reducer = {
|
|
2
|
+
addSpaceOperation(state, action, dispatch) {
|
|
3
|
+
const { id } = action.input;
|
|
4
|
+
if (state.spaces.find((space) => space.id === id)) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
state.spaces.push({
|
|
8
|
+
id,
|
|
9
|
+
title: "",
|
|
10
|
+
description: "",
|
|
11
|
+
packages: [],
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
updateSpaceInfoOperation(state, action, dispatch) {
|
|
15
|
+
const { id, title, description } = action.input;
|
|
16
|
+
const spaceIndex = state.spaces.findIndex((space) => space.id === id);
|
|
17
|
+
if (spaceIndex === -1) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
state.spaces[spaceIndex] = {
|
|
21
|
+
...state.spaces[spaceIndex],
|
|
22
|
+
title: title ?? state.spaces[spaceIndex].title,
|
|
23
|
+
description: description ?? state.spaces[spaceIndex].description,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
removeSpaceOperation(state, action, dispatch) {
|
|
27
|
+
const { id } = action.input;
|
|
28
|
+
const spaceIndex = state.spaces.findIndex((space) => space.id === id);
|
|
29
|
+
if (spaceIndex === -1) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
state.spaces.splice(spaceIndex, 1);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect } from "vitest";
|
|
6
|
+
import utils, { initialGlobalState, initialLocalState, } from "../../gen/utils.js";
|
|
7
|
+
describe("Builder Team Document Model", () => {
|
|
8
|
+
it("should create a new Builder Team document", () => {
|
|
9
|
+
const document = utils.createDocument();
|
|
10
|
+
expect(document).toBeDefined();
|
|
11
|
+
expect(document.header.documentType).toBe("powerhouse/builder-team");
|
|
12
|
+
});
|
|
13
|
+
it("should create a new Builder Team document with a valid initial state", () => {
|
|
14
|
+
const document = utils.createDocument();
|
|
15
|
+
expect(document.state.global).toStrictEqual(initialGlobalState);
|
|
16
|
+
expect(document.state.local).toStrictEqual(initialLocalState);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
6
|
+
import { generateMock } from "@powerhousedao/codegen";
|
|
7
|
+
import utils from "../../gen/utils.js";
|
|
8
|
+
import { z, } from "../../gen/schema/index.js";
|
|
9
|
+
import { reducer } from "../../gen/reducer.js";
|
|
10
|
+
import * as creators from "../../gen/member/creators.js";
|
|
11
|
+
describe("Member Operations", () => {
|
|
12
|
+
let document;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
document = utils.createDocument();
|
|
15
|
+
});
|
|
16
|
+
it("should handle addMember operation", () => {
|
|
17
|
+
const input = generateMock(z.AddMemberInputSchema());
|
|
18
|
+
const updatedDocument = reducer(document, creators.addMember(input));
|
|
19
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
20
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_MEMBER");
|
|
21
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
22
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
23
|
+
});
|
|
24
|
+
it("should handle updateMemberInfo operation", () => {
|
|
25
|
+
const input = generateMock(z.UpdateMemberInfoInputSchema());
|
|
26
|
+
const updatedDocument = reducer(document, creators.updateMemberInfo(input));
|
|
27
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
28
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_MEMBER_INFO");
|
|
29
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
30
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
31
|
+
});
|
|
32
|
+
it("should handle removeMember operation", () => {
|
|
33
|
+
const input = generateMock(z.RemoveMemberInputSchema());
|
|
34
|
+
const updatedDocument = reducer(document, creators.removeMember(input));
|
|
35
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
36
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_MEMBER");
|
|
37
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
38
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
6
|
+
import { generateMock } from "@powerhousedao/codegen";
|
|
7
|
+
import utils from "../../gen/utils.js";
|
|
8
|
+
import { z, } from "../../gen/schema/index.js";
|
|
9
|
+
import { reducer } from "../../gen/reducer.js";
|
|
10
|
+
import * as creators from "../../gen/packages/creators.js";
|
|
11
|
+
describe("Packages Operations", () => {
|
|
12
|
+
let document;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
document = utils.createDocument();
|
|
15
|
+
});
|
|
16
|
+
it("should handle addPackage operation", () => {
|
|
17
|
+
const input = generateMock(z.AddPackageInputSchema());
|
|
18
|
+
const updatedDocument = reducer(document, creators.addPackage(input));
|
|
19
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
20
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_PACKAGE");
|
|
21
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
22
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
23
|
+
});
|
|
24
|
+
it("should handle updatePackageInfo operation", () => {
|
|
25
|
+
const input = generateMock(z.UpdatePackageInfoInputSchema());
|
|
26
|
+
const updatedDocument = reducer(document, creators.updatePackageInfo(input));
|
|
27
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
28
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_PACKAGE_INFO");
|
|
29
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
30
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
31
|
+
});
|
|
32
|
+
it("should handle removePackage operation", () => {
|
|
33
|
+
const input = generateMock(z.RemovePackageInputSchema());
|
|
34
|
+
const updatedDocument = reducer(document, creators.removePackage(input));
|
|
35
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
36
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_PACKAGE");
|
|
37
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
38
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
39
|
+
});
|
|
40
|
+
});
|