@powerhousedao/vetra-builder-package 5.2.0-dev.14 → 5.2.0-dev.16
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/index.d.ts +3 -0
- package/dist/document-models/builder-account/index.d.ts.map +1 -0
- package/dist/document-models/builder-account/index.js +2 -0
- package/dist/document-models/builder-account/v1/module.d.ts +1 -1
- package/dist/document-models/builder-account/v1/module.d.ts.map +1 -1
- package/dist/document-models/builder-account/v1/module.js +4 -1
- package/dist/document-models/builder-team/actions.d.ts +16 -16
- package/dist/document-models/builder-team/actions.d.ts.map +1 -1
- package/dist/document-models/builder-team/gen/schema/zod.js +6 -6
- package/dist/document-models/builder-team/hooks.d.ts +2 -2
- package/dist/document-models/builder-team/hooks.d.ts.map +1 -1
- package/dist/document-models/builder-team/index.d.ts +2 -5
- package/dist/document-models/builder-team/index.d.ts.map +1 -1
- package/dist/document-models/builder-team/index.js +2 -5
- package/dist/document-models/builder-team/upgrades/index.d.ts +3 -0
- package/dist/document-models/builder-team/upgrades/index.d.ts.map +1 -0
- package/dist/document-models/builder-team/upgrades/index.js +2 -0
- package/dist/document-models/builder-team/upgrades/upgrade-manifest.d.ts +4 -0
- package/dist/document-models/builder-team/upgrades/upgrade-manifest.d.ts.map +1 -0
- package/dist/document-models/builder-team/upgrades/upgrade-manifest.js +7 -0
- package/dist/document-models/builder-team/upgrades/versions.d.ts +3 -0
- package/dist/document-models/builder-team/upgrades/versions.d.ts.map +1 -0
- package/dist/document-models/builder-team/upgrades/versions.js +2 -0
- package/dist/document-models/builder-team/v1/actions.d.ts +30 -0
- package/dist/document-models/builder-team/v1/actions.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/actions.js +10 -0
- package/dist/document-models/builder-team/v1/gen/actions.d.ts +10 -0
- package/dist/document-models/builder-team/v1/gen/actions.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/actions.js +4 -0
- package/dist/document-models/builder-team/v1/gen/controller.d.ts +4 -0
- package/dist/document-models/builder-team/v1/gen/controller.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/controller.js +3 -0
- package/dist/document-models/builder-team/v1/gen/creators.d.ts +9 -0
- package/dist/document-models/builder-team/v1/gen/creators.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/creators.js +8 -0
- package/dist/document-models/builder-team/v1/gen/document-model.d.ts +3 -0
- package/dist/document-models/builder-team/v1/gen/document-model.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/document-model.js +234 -0
- package/dist/document-models/builder-team/v1/gen/document-schema.d.ts +50 -0
- package/dist/document-models/builder-team/v1/gen/document-schema.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/document-schema.js +33 -0
- package/dist/document-models/builder-team/v1/gen/document-type.d.ts +2 -0
- package/dist/document-models/builder-team/v1/gen/document-type.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/document-type.js +1 -0
- package/dist/document-models/builder-team/v1/gen/index.d.ts +16 -0
- package/dist/document-models/builder-team/v1/gen/index.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/index.js +15 -0
- package/dist/document-models/builder-team/v1/gen/member/actions.d.ts +16 -0
- package/dist/document-models/builder-team/v1/gen/member/actions.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/member/actions.js +1 -0
- package/dist/document-models/builder-team/v1/gen/member/creators.d.ts +6 -0
- package/dist/document-models/builder-team/v1/gen/member/creators.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/member/creators.js +5 -0
- package/dist/document-models/builder-team/v1/gen/member/error.d.ts +2 -0
- package/dist/document-models/builder-team/v1/gen/member/error.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/member/error.js +1 -0
- package/dist/document-models/builder-team/v1/gen/member/operations.d.ts +9 -0
- package/dist/document-models/builder-team/v1/gen/member/operations.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/member/operations.js +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/actions.d.ts +20 -0
- package/dist/document-models/builder-team/v1/gen/packages/actions.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/actions.js +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/creators.d.ts +7 -0
- package/dist/document-models/builder-team/v1/gen/packages/creators.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/creators.js +6 -0
- package/dist/document-models/builder-team/v1/gen/packages/error.d.ts +2 -0
- package/dist/document-models/builder-team/v1/gen/packages/error.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/error.js +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/operations.d.ts +10 -0
- package/dist/document-models/builder-team/v1/gen/packages/operations.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/packages/operations.js +1 -0
- package/dist/document-models/builder-team/v1/gen/ph-factories.d.ts +23 -0
- package/dist/document-models/builder-team/v1/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/ph-factories.js +59 -0
- package/dist/document-models/builder-team/v1/gen/profile/actions.d.ts +24 -0
- package/dist/document-models/builder-team/v1/gen/profile/actions.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/profile/actions.js +1 -0
- package/dist/document-models/builder-team/v1/gen/profile/creators.d.ts +8 -0
- package/dist/document-models/builder-team/v1/gen/profile/creators.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/profile/creators.js +7 -0
- package/dist/document-models/builder-team/v1/gen/profile/error.d.ts +2 -0
- package/dist/document-models/builder-team/v1/gen/profile/error.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/profile/error.js +1 -0
- package/dist/document-models/builder-team/v1/gen/profile/operations.d.ts +11 -0
- package/dist/document-models/builder-team/v1/gen/profile/operations.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/profile/operations.js +1 -0
- package/dist/document-models/builder-team/v1/gen/reducer.d.ts +3 -0
- package/dist/document-models/builder-team/v1/gen/reducer.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/reducer.js +96 -0
- package/dist/document-models/builder-team/v1/gen/schema/index.d.ts +3 -0
- package/dist/document-models/builder-team/v1/gen/schema/index.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/schema/index.js +2 -0
- package/dist/document-models/builder-team/v1/gen/schema/types.d.ts +255 -0
- package/dist/document-models/builder-team/v1/gen/schema/types.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/schema/types.js +1 -0
- package/dist/document-models/builder-team/v1/gen/schema/zod.d.ts +32 -0
- package/dist/document-models/builder-team/v1/gen/schema/zod.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/schema/zod.js +161 -0
- package/dist/document-models/builder-team/v1/gen/spaces/actions.d.ts +20 -0
- package/dist/document-models/builder-team/v1/gen/spaces/actions.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/spaces/actions.js +1 -0
- package/dist/document-models/builder-team/v1/gen/spaces/creators.d.ts +7 -0
- package/dist/document-models/builder-team/v1/gen/spaces/creators.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/spaces/creators.js +6 -0
- package/dist/document-models/builder-team/v1/gen/spaces/error.d.ts +2 -0
- package/dist/document-models/builder-team/v1/gen/spaces/error.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/spaces/error.js +1 -0
- package/dist/document-models/builder-team/v1/gen/spaces/operations.d.ts +10 -0
- package/dist/document-models/builder-team/v1/gen/spaces/operations.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/spaces/operations.js +1 -0
- package/dist/document-models/builder-team/v1/gen/types.d.ts +12 -0
- package/dist/document-models/builder-team/v1/gen/types.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/types.js +1 -0
- package/dist/document-models/builder-team/v1/gen/utils.d.ts +15 -0
- package/dist/document-models/builder-team/v1/gen/utils.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/gen/utils.js +63 -0
- package/dist/document-models/builder-team/v1/hooks.d.ts +14 -0
- package/dist/document-models/builder-team/v1/hooks.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/hooks.js +25 -0
- package/dist/document-models/builder-team/v1/index.d.ts +6 -0
- package/dist/document-models/builder-team/v1/index.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/index.js +5 -0
- package/dist/document-models/builder-team/v1/module.d.ts +5 -0
- package/dist/document-models/builder-team/v1/module.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/module.js +14 -0
- package/dist/document-models/builder-team/v1/src/index.d.ts +2 -0
- package/dist/document-models/builder-team/v1/src/index.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/src/index.js +1 -0
- package/dist/document-models/builder-team/v1/src/reducers/member.d.ts +3 -0
- package/dist/document-models/builder-team/v1/src/reducers/member.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/src/reducers/member.js +14 -0
- package/dist/document-models/builder-team/v1/src/reducers/packages.d.ts +3 -0
- package/dist/document-models/builder-team/v1/src/reducers/packages.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/src/reducers/packages.js +28 -0
- package/dist/document-models/builder-team/v1/src/reducers/profile.d.ts +3 -0
- package/dist/document-models/builder-team/v1/src/reducers/profile.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/src/reducers/profile.js +22 -0
- package/dist/document-models/builder-team/v1/src/reducers/spaces.d.ts +3 -0
- package/dist/document-models/builder-team/v1/src/reducers/spaces.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/src/reducers/spaces.js +23 -0
- package/dist/document-models/builder-team/v1/src/utils.d.ts +2 -0
- package/dist/document-models/builder-team/v1/src/utils.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/src/utils.js +1 -0
- package/dist/document-models/builder-team/v1/tests/document-model.test.d.ts +10 -0
- package/dist/document-models/builder-team/v1/tests/document-model.test.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/tests/document-model.test.js +104 -0
- package/dist/document-models/builder-team/v1/tests/member.test.d.ts +2 -0
- package/dist/document-models/builder-team/v1/tests/member.test.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/tests/member.test.js +35 -0
- package/dist/document-models/builder-team/v1/tests/packages.test.d.ts +2 -0
- package/dist/document-models/builder-team/v1/tests/packages.test.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/tests/packages.test.js +45 -0
- package/dist/document-models/builder-team/v1/tests/profile.test.d.ts +2 -0
- package/dist/document-models/builder-team/v1/tests/profile.test.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/tests/profile.test.js +55 -0
- package/dist/document-models/builder-team/v1/tests/spaces.test.d.ts +2 -0
- package/dist/document-models/builder-team/v1/tests/spaces.test.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/tests/spaces.test.js +45 -0
- package/dist/document-models/builder-team/v1/utils.d.ts +14 -0
- package/dist/document-models/builder-team/v1/utils.d.ts.map +1 -0
- package/dist/document-models/builder-team/v1/utils.js +7 -0
- package/dist/document-models/document-models.d.ts.map +1 -1
- package/dist/document-models/document-models.js +4 -0
- package/dist/document-models/index.d.ts +2 -0
- package/dist/document-models/index.d.ts.map +1 -1
- package/dist/document-models/index.js +2 -0
- package/dist/document-models/upgrade-manifests.d.ts.map +1 -1
- package/dist/document-models/upgrade-manifests.js +6 -1
- package/dist/style.css +7 -1
- package/package.json +29 -33
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { baseCreateDocument, baseSaveToFileHandle, baseLoadFromInput, defaultBaseState, generateId, } from "document-model/core";
|
|
2
|
+
import { reducer } from "./reducer.js";
|
|
3
|
+
import { builderTeamDocumentType } from "./document-type.js";
|
|
4
|
+
import { isBuilderTeamDocument, assertIsBuilderTeamDocument, isBuilderTeamState, assertIsBuilderTeamState, } from "./document-schema.js";
|
|
5
|
+
export const initialGlobalState = {
|
|
6
|
+
profile: {
|
|
7
|
+
logo: null,
|
|
8
|
+
name: "",
|
|
9
|
+
slug: "",
|
|
10
|
+
description: null,
|
|
11
|
+
socials: {
|
|
12
|
+
xProfile: null,
|
|
13
|
+
github: null,
|
|
14
|
+
website: null,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
members: [],
|
|
18
|
+
spaces: [],
|
|
19
|
+
};
|
|
20
|
+
export const initialLocalState = {};
|
|
21
|
+
export const utils = {
|
|
22
|
+
fileExtension: "phvba",
|
|
23
|
+
createState(state) {
|
|
24
|
+
return {
|
|
25
|
+
...defaultBaseState(),
|
|
26
|
+
global: { ...initialGlobalState, ...state?.global },
|
|
27
|
+
local: { ...initialLocalState, ...state?.local },
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
createDocument(state) {
|
|
31
|
+
const document = baseCreateDocument(utils.createState, state);
|
|
32
|
+
document.header.documentType = builderTeamDocumentType;
|
|
33
|
+
// for backwards compatibility, but this is NOT a valid signed document id
|
|
34
|
+
document.header.id = generateId();
|
|
35
|
+
return document;
|
|
36
|
+
},
|
|
37
|
+
saveToFileHandle(document, input) {
|
|
38
|
+
return baseSaveToFileHandle(document, input);
|
|
39
|
+
},
|
|
40
|
+
loadFromInput(input) {
|
|
41
|
+
return baseLoadFromInput(input, reducer);
|
|
42
|
+
},
|
|
43
|
+
isStateOfType(state) {
|
|
44
|
+
return isBuilderTeamState(state);
|
|
45
|
+
},
|
|
46
|
+
assertIsStateOfType(state) {
|
|
47
|
+
return assertIsBuilderTeamState(state);
|
|
48
|
+
},
|
|
49
|
+
isDocumentOfType(document) {
|
|
50
|
+
return isBuilderTeamDocument(document);
|
|
51
|
+
},
|
|
52
|
+
assertIsDocumentOfType(document) {
|
|
53
|
+
return assertIsBuilderTeamDocument(document);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
export const createDocument = utils.createDocument;
|
|
57
|
+
export const createState = utils.createState;
|
|
58
|
+
export const saveToFileHandle = utils.saveToFileHandle;
|
|
59
|
+
export const loadFromInput = utils.loadFromInput;
|
|
60
|
+
export const isStateOfType = utils.isStateOfType;
|
|
61
|
+
export const assertIsStateOfType = utils.assertIsStateOfType;
|
|
62
|
+
export const isDocumentOfType = utils.isDocumentOfType;
|
|
63
|
+
export const assertIsDocumentOfType = utils.assertIsDocumentOfType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import type { BuilderTeamAction, BuilderTeamDocument } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
3
|
+
/** Hook to get a BuilderTeam document by its id */
|
|
4
|
+
export declare function useBuilderTeamDocumentById(documentId: string | null | undefined): [BuilderTeamDocument, DocumentDispatch<BuilderTeamAction>] | [undefined, undefined];
|
|
5
|
+
/** Hook to get the selected BuilderTeam document */
|
|
6
|
+
export declare function useSelectedBuilderTeamDocument(): [
|
|
7
|
+
BuilderTeamDocument,
|
|
8
|
+
DocumentDispatch<BuilderTeamAction>
|
|
9
|
+
];
|
|
10
|
+
/** Hook to get all BuilderTeam documents in the selected drive */
|
|
11
|
+
export declare function useBuilderTeamDocumentsInSelectedDrive(): BuilderTeamDocument[] | undefined;
|
|
12
|
+
/** Hook to get all BuilderTeam documents in the selected folder */
|
|
13
|
+
export declare function useBuilderTeamDocumentsInSelectedFolder(): BuilderTeamDocument[] | undefined;
|
|
14
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../document-models/builder-team/v1/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,sEAAsE,CAAC;AAM9E,mDAAmD;AACnD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,GAC1D,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,oDAAoD;AACpD,wBAAgB,8BAA8B,IAAI;IAChD,mBAAmB;IACnB,gBAAgB,CAAC,iBAAiB,CAAC;CACpC,CAKA;AAED,kEAAkE;AAClE,wBAAgB,sCAAsC,sCAGrD;AAED,mEAAmE;AACnE,wBAAgB,uCAAuC,sCAGtD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { assertIsBuilderTeamDocument, isBuilderTeamDocument, } from "./gen/document-schema.js";
|
|
3
|
+
/** Hook to get a BuilderTeam document by its id */
|
|
4
|
+
export function useBuilderTeamDocumentById(documentId) {
|
|
5
|
+
const [document, dispatch] = useDocumentById(documentId);
|
|
6
|
+
if (!isBuilderTeamDocument(document))
|
|
7
|
+
return [undefined, undefined];
|
|
8
|
+
return [document, dispatch];
|
|
9
|
+
}
|
|
10
|
+
/** Hook to get the selected BuilderTeam document */
|
|
11
|
+
export function useSelectedBuilderTeamDocument() {
|
|
12
|
+
const [document, dispatch] = useSelectedDocument();
|
|
13
|
+
assertIsBuilderTeamDocument(document);
|
|
14
|
+
return [document, dispatch];
|
|
15
|
+
}
|
|
16
|
+
/** Hook to get all BuilderTeam documents in the selected drive */
|
|
17
|
+
export function useBuilderTeamDocumentsInSelectedDrive() {
|
|
18
|
+
const documentsInSelectedDrive = useDocumentsInSelectedDrive();
|
|
19
|
+
return documentsInSelectedDrive?.filter(isBuilderTeamDocument);
|
|
20
|
+
}
|
|
21
|
+
/** Hook to get all BuilderTeam documents in the selected folder */
|
|
22
|
+
export function useBuilderTeamDocumentsInSelectedFolder() {
|
|
23
|
+
const documentsInSelectedFolder = useDocumentsInSelectedFolder();
|
|
24
|
+
return documentsInSelectedFolder?.filter(isBuilderTeamDocument);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../document-models/builder-team/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DocumentModelModule } from "document-model";
|
|
2
|
+
import type { BuilderTeamPHState } from "./gen/types.js";
|
|
3
|
+
/** Document model module for the BuilderTeam document type */
|
|
4
|
+
export declare const BuilderTeam: DocumentModelModule<BuilderTeamPHState>;
|
|
5
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../document-models/builder-team/v1/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMzD,8DAA8D;AAC9D,eAAO,MAAM,WAAW,EAAE,mBAAmB,CAAC,kBAAkB,CAM/D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createState } from "document-model";
|
|
2
|
+
import { defaultBaseState } from "document-model/core";
|
|
3
|
+
import { documentModel } from "./gen/document-model.js";
|
|
4
|
+
import { reducer } from "./gen/reducer.js";
|
|
5
|
+
import { actions } from "./actions.js";
|
|
6
|
+
import { utils } from "./utils.js";
|
|
7
|
+
/** Document model module for the BuilderTeam document type */
|
|
8
|
+
export const BuilderTeam = {
|
|
9
|
+
version: 1,
|
|
10
|
+
reducer,
|
|
11
|
+
actions,
|
|
12
|
+
utils,
|
|
13
|
+
documentModel: createState(defaultBaseState(), documentModel),
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./utils.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../../../../document-models/builder-team/v1/src/reducers/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AAExH,eAAO,MAAM,2BAA2B,EAAE,2BAazC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const builderTeamMemberOperations = {
|
|
2
|
+
addMemberOperation(state, action) {
|
|
3
|
+
// TODO: implement addMemberOperation reducer
|
|
4
|
+
throw new Error("Reducer for 'addMemberOperation' not implemented.");
|
|
5
|
+
},
|
|
6
|
+
updateMemberInfoOperation(state, action) {
|
|
7
|
+
// TODO: implement updateMemberInfoOperation reducer
|
|
8
|
+
throw new Error("Reducer for 'updateMemberInfoOperation' not implemented.");
|
|
9
|
+
},
|
|
10
|
+
removeMemberOperation(state, action) {
|
|
11
|
+
// TODO: implement removeMemberOperation reducer
|
|
12
|
+
throw new Error("Reducer for 'removeMemberOperation' not implemented.");
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../../../../document-models/builder-team/v1/src/reducers/packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sEAAsE,CAAC;AAE1H,eAAO,MAAM,6BAA6B,EAAE,6BAoC3C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const builderTeamPackagesOperations = {
|
|
2
|
+
addPackageOperation(state, action) {
|
|
3
|
+
// TODO: implement addPackageOperation reducer
|
|
4
|
+
throw new Error("Reducer for 'addPackageOperation' not implemented.");
|
|
5
|
+
},
|
|
6
|
+
updatePackageInfoOperation(state, action) {
|
|
7
|
+
// TODO: implement updatePackageInfoOperation reducer
|
|
8
|
+
throw new Error("Reducer for 'updatePackageInfoOperation' not implemented.");
|
|
9
|
+
},
|
|
10
|
+
removePackageOperation(state, action) {
|
|
11
|
+
// TODO: implement removePackageOperation reducer
|
|
12
|
+
throw new Error("Reducer for 'removePackageOperation' not implemented.");
|
|
13
|
+
},
|
|
14
|
+
reorderPackagesOperation(state, action) {
|
|
15
|
+
const { spaceId, packageIds, targetIndex } = action.input;
|
|
16
|
+
// Find the space
|
|
17
|
+
const space = state.spaces.find((s) => s.id === spaceId);
|
|
18
|
+
if (!space) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// Find the packages to move
|
|
22
|
+
const packagesToMove = space.packages.filter((pkg) => packageIds.includes(pkg.id));
|
|
23
|
+
const remainingPackages = space.packages.filter((pkg) => !packageIds.includes(pkg.id));
|
|
24
|
+
// Insert the packages at the target index
|
|
25
|
+
remainingPackages.splice(targetIndex, 0, ...packagesToMove);
|
|
26
|
+
space.packages = remainingPackages;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../../../document-models/builder-team/v1/src/reducers/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sEAAsE,CAAC;AAEzH,eAAO,MAAM,4BAA4B,EAAE,4BAqB1C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const builderTeamProfileOperations = {
|
|
2
|
+
setLogoOperation(state, action) {
|
|
3
|
+
// TODO: implement setLogoOperation reducer
|
|
4
|
+
throw new Error("Reducer for 'setLogoOperation' not implemented.");
|
|
5
|
+
},
|
|
6
|
+
setTeamNameOperation(state, action) {
|
|
7
|
+
// TODO: implement setTeamNameOperation reducer
|
|
8
|
+
throw new Error("Reducer for 'setTeamNameOperation' not implemented.");
|
|
9
|
+
},
|
|
10
|
+
setSlugOperation(state, action) {
|
|
11
|
+
// TODO: implement setSlugOperation reducer
|
|
12
|
+
throw new Error("Reducer for 'setSlugOperation' not implemented.");
|
|
13
|
+
},
|
|
14
|
+
setDescriptionOperation(state, action) {
|
|
15
|
+
// TODO: implement setDescriptionOperation reducer
|
|
16
|
+
throw new Error("Reducer for 'setDescriptionOperation' not implemented.");
|
|
17
|
+
},
|
|
18
|
+
setSocialsOperation(state, action) {
|
|
19
|
+
// TODO: implement setSocialsOperation reducer
|
|
20
|
+
throw new Error("Reducer for 'setSocialsOperation' not implemented.");
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../../../../../document-models/builder-team/v1/src/reducers/spaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AAExH,eAAO,MAAM,2BAA2B,EAAE,2BA4BzC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const builderTeamSpacesOperations = {
|
|
2
|
+
addSpaceOperation(state, action) {
|
|
3
|
+
// TODO: implement addSpaceOperation reducer
|
|
4
|
+
throw new Error("Reducer for 'addSpaceOperation' not implemented.");
|
|
5
|
+
},
|
|
6
|
+
updateSpaceInfoOperation(state, action) {
|
|
7
|
+
// TODO: implement updateSpaceInfoOperation reducer
|
|
8
|
+
throw new Error("Reducer for 'updateSpaceInfoOperation' not implemented.");
|
|
9
|
+
},
|
|
10
|
+
removeSpaceOperation(state, action) {
|
|
11
|
+
// TODO: implement removeSpaceOperation reducer
|
|
12
|
+
throw new Error("Reducer for 'removeSpaceOperation' not implemented.");
|
|
13
|
+
},
|
|
14
|
+
reorderSpacesOperation(state, action) {
|
|
15
|
+
const { spaceIds, targetIndex } = action.input;
|
|
16
|
+
// Find the spaces to move
|
|
17
|
+
const spacesToMove = state.spaces.filter((space) => spaceIds.includes(space.id));
|
|
18
|
+
const remainingSpaces = state.spaces.filter((space) => !spaceIds.includes(space.id));
|
|
19
|
+
// Insert the spaces at the target index
|
|
20
|
+
remainingSpaces.splice(targetIndex, 0, ...spacesToMove);
|
|
21
|
+
state.spaces = remainingSpaces;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* This is a scaffold file meant for customization:
|
|
7
|
+
* - change it by adding new tests or modifying the existing ones
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=document-model.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;GAGG"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - change it by adding new tests or modifying the existing ones
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* This is a scaffold file meant for customization:
|
|
7
|
+
* - change it by adding new tests or modifying the existing ones
|
|
8
|
+
*/
|
|
9
|
+
import { describe, it, expect } from "vitest";
|
|
10
|
+
import { utils, initialGlobalState, initialLocalState, builderTeamDocumentType, isBuilderTeamDocument, assertIsBuilderTeamDocument, isBuilderTeamState, assertIsBuilderTeamState, } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
11
|
+
import { ZodError } from "zod";
|
|
12
|
+
describe("BuilderTeam Document Model", () => {
|
|
13
|
+
it("should create a new BuilderTeam document", () => {
|
|
14
|
+
const document = utils.createDocument();
|
|
15
|
+
expect(document).toBeDefined();
|
|
16
|
+
expect(document.header.documentType).toBe(builderTeamDocumentType);
|
|
17
|
+
});
|
|
18
|
+
it("should create a new BuilderTeam document with a valid initial state", () => {
|
|
19
|
+
const document = utils.createDocument();
|
|
20
|
+
expect(document.state.global).toStrictEqual(initialGlobalState);
|
|
21
|
+
expect(document.state.local).toStrictEqual(initialLocalState);
|
|
22
|
+
expect(isBuilderTeamDocument(document)).toBe(true);
|
|
23
|
+
expect(isBuilderTeamState(document.state)).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it("should reject a document that is not a BuilderTeam document", () => {
|
|
26
|
+
const wrongDocumentType = utils.createDocument();
|
|
27
|
+
wrongDocumentType.header.documentType = "the-wrong-thing-1234";
|
|
28
|
+
try {
|
|
29
|
+
expect(assertIsBuilderTeamDocument(wrongDocumentType)).toThrow();
|
|
30
|
+
expect(isBuilderTeamDocument(wrongDocumentType)).toBe(false);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const wrongState = utils.createDocument();
|
|
37
|
+
// @ts-expect-error - we are testing the error case
|
|
38
|
+
wrongState.state.global = {
|
|
39
|
+
...{ notWhat: "you want" },
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
expect(isBuilderTeamState(wrongState.state)).toBe(false);
|
|
43
|
+
expect(assertIsBuilderTeamState(wrongState.state)).toThrow();
|
|
44
|
+
expect(isBuilderTeamDocument(wrongState)).toBe(false);
|
|
45
|
+
expect(assertIsBuilderTeamDocument(wrongState)).toThrow();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
49
|
+
}
|
|
50
|
+
const wrongInitialState = utils.createDocument();
|
|
51
|
+
// @ts-expect-error - we are testing the error case
|
|
52
|
+
wrongInitialState.initialState.global = {
|
|
53
|
+
...{ notWhat: "you want" },
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
expect(isBuilderTeamState(wrongInitialState.state)).toBe(false);
|
|
57
|
+
expect(assertIsBuilderTeamState(wrongInitialState.state)).toThrow();
|
|
58
|
+
expect(isBuilderTeamDocument(wrongInitialState)).toBe(false);
|
|
59
|
+
expect(assertIsBuilderTeamDocument(wrongInitialState)).toThrow();
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
63
|
+
}
|
|
64
|
+
const missingIdInHeader = utils.createDocument();
|
|
65
|
+
// @ts-expect-error - we are testing the error case
|
|
66
|
+
delete missingIdInHeader.header.id;
|
|
67
|
+
try {
|
|
68
|
+
expect(isBuilderTeamDocument(missingIdInHeader)).toBe(false);
|
|
69
|
+
expect(assertIsBuilderTeamDocument(missingIdInHeader)).toThrow();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
73
|
+
}
|
|
74
|
+
const missingNameInHeader = utils.createDocument();
|
|
75
|
+
// @ts-expect-error - we are testing the error case
|
|
76
|
+
delete missingNameInHeader.header.name;
|
|
77
|
+
try {
|
|
78
|
+
expect(isBuilderTeamDocument(missingNameInHeader)).toBe(false);
|
|
79
|
+
expect(assertIsBuilderTeamDocument(missingNameInHeader)).toThrow();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
83
|
+
}
|
|
84
|
+
const missingCreatedAtUtcIsoInHeader = utils.createDocument();
|
|
85
|
+
// @ts-expect-error - we are testing the error case
|
|
86
|
+
delete missingCreatedAtUtcIsoInHeader.header.createdAtUtcIso;
|
|
87
|
+
try {
|
|
88
|
+
expect(isBuilderTeamDocument(missingCreatedAtUtcIsoInHeader)).toBe(false);
|
|
89
|
+
expect(assertIsBuilderTeamDocument(missingCreatedAtUtcIsoInHeader)).toThrow();
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
93
|
+
}
|
|
94
|
+
const missingLastModifiedAtUtcIsoInHeader = utils.createDocument();
|
|
95
|
+
// @ts-expect-error - we are testing the error case
|
|
96
|
+
delete missingLastModifiedAtUtcIsoInHeader.header.lastModifiedAtUtcIso;
|
|
97
|
+
try {
|
|
98
|
+
expect(isBuilderTeamDocument(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
|
|
99
|
+
expect(assertIsBuilderTeamDocument(missingLastModifiedAtUtcIsoInHeader)).toThrow();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/member.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { generateMock } from "@powerhousedao/common/utils";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { reducer, utils, isBuilderTeamDocument, addMember, updateMemberInfo, removeMember, AddMemberInputSchema, UpdateMemberInfoInputSchema, RemoveMemberInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
4
|
+
describe("MemberOperations", () => {
|
|
5
|
+
it("should handle addMember operation", () => {
|
|
6
|
+
const document = utils.createDocument();
|
|
7
|
+
const input = generateMock(AddMemberInputSchema());
|
|
8
|
+
const updatedDocument = reducer(document, addMember(input));
|
|
9
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_MEMBER");
|
|
12
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
+
});
|
|
15
|
+
it("should handle updateMemberInfo operation", () => {
|
|
16
|
+
const document = utils.createDocument();
|
|
17
|
+
const input = generateMock(UpdateMemberInfoInputSchema());
|
|
18
|
+
const updatedDocument = reducer(document, updateMemberInfo(input));
|
|
19
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_MEMBER_INFO");
|
|
22
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
+
});
|
|
25
|
+
it("should handle removeMember operation", () => {
|
|
26
|
+
const document = utils.createDocument();
|
|
27
|
+
const input = generateMock(RemoveMemberInputSchema());
|
|
28
|
+
const updatedDocument = reducer(document, removeMember(input));
|
|
29
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_MEMBER");
|
|
32
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/packages.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { generateMock } from "@powerhousedao/common/utils";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { reducer, utils, isBuilderTeamDocument, addPackage, updatePackageInfo, removePackage, reorderPackages, AddPackageInputSchema, UpdatePackageInfoInputSchema, RemovePackageInputSchema, ReorderPackagesInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
4
|
+
describe("PackagesOperations", () => {
|
|
5
|
+
it("should handle addPackage operation", () => {
|
|
6
|
+
const document = utils.createDocument();
|
|
7
|
+
const input = generateMock(AddPackageInputSchema());
|
|
8
|
+
const updatedDocument = reducer(document, addPackage(input));
|
|
9
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_PACKAGE");
|
|
12
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
+
});
|
|
15
|
+
it("should handle updatePackageInfo operation", () => {
|
|
16
|
+
const document = utils.createDocument();
|
|
17
|
+
const input = generateMock(UpdatePackageInfoInputSchema());
|
|
18
|
+
const updatedDocument = reducer(document, updatePackageInfo(input));
|
|
19
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_PACKAGE_INFO");
|
|
22
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
+
});
|
|
25
|
+
it("should handle removePackage operation", () => {
|
|
26
|
+
const document = utils.createDocument();
|
|
27
|
+
const input = generateMock(RemovePackageInputSchema());
|
|
28
|
+
const updatedDocument = reducer(document, removePackage(input));
|
|
29
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_PACKAGE");
|
|
32
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
+
});
|
|
35
|
+
it("should handle reorderPackages operation", () => {
|
|
36
|
+
const document = utils.createDocument();
|
|
37
|
+
const input = generateMock(ReorderPackagesInputSchema());
|
|
38
|
+
const updatedDocument = reducer(document, reorderPackages(input));
|
|
39
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
40
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("REORDER_PACKAGES");
|
|
42
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/profile.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { generateMock } from "@powerhousedao/common/utils";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { reducer, utils, isBuilderTeamDocument, setLogo, setTeamName, setSlug, setDescription, setSocials, SetLogoInputSchema, SetTeamNameInputSchema, SetSlugInputSchema, SetDescriptionInputSchema, SetSocialsInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
4
|
+
describe("ProfileOperations", () => {
|
|
5
|
+
it("should handle setLogo operation", () => {
|
|
6
|
+
const document = utils.createDocument();
|
|
7
|
+
const input = generateMock(SetLogoInputSchema());
|
|
8
|
+
const updatedDocument = reducer(document, setLogo(input));
|
|
9
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("SET_LOGO");
|
|
12
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
+
});
|
|
15
|
+
it("should handle setTeamName operation", () => {
|
|
16
|
+
const document = utils.createDocument();
|
|
17
|
+
const input = generateMock(SetTeamNameInputSchema());
|
|
18
|
+
const updatedDocument = reducer(document, setTeamName(input));
|
|
19
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("SET_TEAM_NAME");
|
|
22
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
+
});
|
|
25
|
+
it("should handle setSlug operation", () => {
|
|
26
|
+
const document = utils.createDocument();
|
|
27
|
+
const input = generateMock(SetSlugInputSchema());
|
|
28
|
+
const updatedDocument = reducer(document, setSlug(input));
|
|
29
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SLUG");
|
|
32
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
+
});
|
|
35
|
+
it("should handle setDescription operation", () => {
|
|
36
|
+
const document = utils.createDocument();
|
|
37
|
+
const input = generateMock(SetDescriptionInputSchema());
|
|
38
|
+
const updatedDocument = reducer(document, setDescription(input));
|
|
39
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
40
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("SET_DESCRIPTION");
|
|
42
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
+
});
|
|
45
|
+
it("should handle setSocials operation", () => {
|
|
46
|
+
const document = utils.createDocument();
|
|
47
|
+
const input = generateMock(SetSocialsInputSchema());
|
|
48
|
+
const updatedDocument = reducer(document, setSocials(input));
|
|
49
|
+
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
50
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
51
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SOCIALS");
|
|
52
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
53
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaces.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/spaces.test.ts"],"names":[],"mappings":""}
|