@powerhousedao/vetra-builder-package 5.1.0-staging → 5.2.0-staging.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.
Files changed (61) hide show
  1. package/dist/document-models/builder-team/actions.d.ts.map +1 -1
  2. package/dist/document-models/builder-team/gen/document-model.js +2 -2
  3. package/dist/document-models/builder-team/gen/document-schema.d.ts +21 -151
  4. package/dist/document-models/builder-team/gen/document-schema.d.ts.map +1 -1
  5. package/dist/document-models/builder-team/gen/member/actions.d.ts +1 -1
  6. package/dist/document-models/builder-team/gen/member/actions.d.ts.map +1 -1
  7. package/dist/document-models/builder-team/gen/member/actions.js +1 -1
  8. package/dist/document-models/builder-team/gen/member/operations.d.ts +2 -2
  9. package/dist/document-models/builder-team/gen/member/operations.d.ts.map +1 -1
  10. package/dist/document-models/builder-team/gen/member/operations.js +0 -2
  11. package/dist/document-models/builder-team/gen/packages/actions.d.ts +1 -1
  12. package/dist/document-models/builder-team/gen/packages/actions.d.ts.map +1 -1
  13. package/dist/document-models/builder-team/gen/packages/actions.js +1 -1
  14. package/dist/document-models/builder-team/gen/packages/operations.d.ts +2 -2
  15. package/dist/document-models/builder-team/gen/packages/operations.d.ts.map +1 -1
  16. package/dist/document-models/builder-team/gen/packages/operations.js +0 -2
  17. package/dist/document-models/builder-team/gen/profile/actions.d.ts +1 -1
  18. package/dist/document-models/builder-team/gen/profile/actions.d.ts.map +1 -1
  19. package/dist/document-models/builder-team/gen/profile/actions.js +1 -1
  20. package/dist/document-models/builder-team/gen/profile/operations.d.ts +2 -2
  21. package/dist/document-models/builder-team/gen/profile/operations.d.ts.map +1 -1
  22. package/dist/document-models/builder-team/gen/profile/operations.js +0 -2
  23. package/dist/document-models/builder-team/gen/reducer.d.ts.map +1 -1
  24. package/dist/document-models/builder-team/gen/reducer.js +32 -16
  25. package/dist/document-models/builder-team/gen/schema/types.d.ts +13 -1
  26. package/dist/document-models/builder-team/gen/schema/types.d.ts.map +1 -1
  27. package/dist/document-models/builder-team/gen/schema/zod.d.ts +3 -3
  28. package/dist/document-models/builder-team/gen/schema/zod.d.ts.map +1 -1
  29. package/dist/document-models/builder-team/gen/schema/zod.js +22 -22
  30. package/dist/document-models/builder-team/gen/spaces/actions.d.ts +1 -1
  31. package/dist/document-models/builder-team/gen/spaces/actions.d.ts.map +1 -1
  32. package/dist/document-models/builder-team/gen/spaces/actions.js +1 -1
  33. package/dist/document-models/builder-team/gen/spaces/operations.d.ts +2 -2
  34. package/dist/document-models/builder-team/gen/spaces/operations.d.ts.map +1 -1
  35. package/dist/document-models/builder-team/gen/spaces/operations.js +0 -2
  36. package/dist/document-models/builder-team/gen/types.d.ts.map +1 -1
  37. package/dist/document-models/builder-team/index.d.ts +0 -4
  38. package/dist/document-models/builder-team/index.d.ts.map +1 -1
  39. package/dist/document-models/builder-team/index.js +0 -4
  40. package/dist/document-models/builder-team/src/reducers/member.d.ts.map +1 -1
  41. package/dist/document-models/builder-team/src/reducers/member.js +4 -1
  42. package/dist/document-models/builder-team/src/reducers/packages.d.ts.map +1 -1
  43. package/dist/document-models/builder-team/src/reducers/packages.js +3 -3
  44. package/dist/document-models/builder-team/src/reducers/spaces.d.ts.map +1 -1
  45. package/dist/document-models/builder-team/src/reducers/spaces.js +2 -2
  46. package/dist/document-models/builder-team/src/tests/document-model.test.d.ts +4 -0
  47. package/dist/document-models/builder-team/src/tests/document-model.test.d.ts.map +1 -1
  48. package/dist/document-models/builder-team/src/tests/document-model.test.js +91 -6
  49. package/dist/document-models/builder-team/src/tests/member.test.d.ts +0 -4
  50. package/dist/document-models/builder-team/src/tests/member.test.d.ts.map +1 -1
  51. package/dist/document-models/builder-team/src/tests/member.test.js +12 -17
  52. package/dist/document-models/builder-team/src/tests/packages.test.d.ts +0 -4
  53. package/dist/document-models/builder-team/src/tests/packages.test.d.ts.map +1 -1
  54. package/dist/document-models/builder-team/src/tests/packages.test.js +22 -17
  55. package/dist/document-models/builder-team/src/tests/profile.test.d.ts +0 -4
  56. package/dist/document-models/builder-team/src/tests/profile.test.d.ts.map +1 -1
  57. package/dist/document-models/builder-team/src/tests/profile.test.js +18 -19
  58. package/dist/document-models/builder-team/src/tests/spaces.test.d.ts +0 -4
  59. package/dist/document-models/builder-team/src/tests/spaces.test.d.ts.map +1 -1
  60. package/dist/document-models/builder-team/src/tests/spaces.test.js +22 -17
  61. package/package.json +35 -34
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  export const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
3
3
  export const definedNonNullAnySchema = z
4
4
  .any()
@@ -22,9 +22,9 @@ export function AddSpaceInputSchema() {
22
22
  export function BuilderTeamStateSchema() {
23
23
  return z.object({
24
24
  __typename: z.literal("BuilderTeamState").optional(),
25
- members: z.array(RenownProfileInfoSchema()),
26
- profile: VetraBuilderProfileSchema(),
27
- spaces: z.array(VetraBuilderSpaceSchema()),
25
+ members: z.array(z.lazy(() => RenownProfileInfoSchema())),
26
+ profile: z.lazy(() => VetraBuilderProfileSchema()),
27
+ spaces: z.array(z.lazy(() => VetraBuilderSpaceSchema())),
28
28
  });
29
29
  }
30
30
  export function RemoveMemberInputSchema() {
@@ -45,11 +45,11 @@ export function RemoveSpaceInputSchema() {
45
45
  export function RenownProfileInfoSchema() {
46
46
  return z.object({
47
47
  __typename: z.literal("RenownProfileInfo").optional(),
48
- ethAddress: z.string().nullable(),
48
+ ethAddress: z.string().nullish(),
49
49
  id: z.string(),
50
- name: z.string().nullable(),
51
- phid: z.string().nullable(),
52
- profileImage: z.string().nullable(),
50
+ name: z.string().nullish(),
51
+ phid: z.string().nullish(),
52
+ profileImage: z.string().nullish(),
53
53
  });
54
54
  }
55
55
  export function ReorderPackagesInputSchema() {
@@ -123,39 +123,39 @@ export function UpdateSpaceInfoInputSchema() {
123
123
  export function VetraBuilderProfileSchema() {
124
124
  return z.object({
125
125
  __typename: z.literal("VetraBuilderProfile").optional(),
126
- description: z.string().nullable(),
127
- logo: z.string().url().nullable(),
126
+ description: z.string().nullish(),
127
+ logo: z.string().url().nullish(),
128
128
  name: z.string(),
129
129
  slug: z.string(),
130
- socials: VetraBuilderSocialsSchema(),
130
+ socials: z.lazy(() => VetraBuilderSocialsSchema()),
131
131
  });
132
132
  }
133
133
  export function VetraBuilderSocialsSchema() {
134
134
  return z.object({
135
135
  __typename: z.literal("VetraBuilderSocials").optional(),
136
- github: z.string().url().nullable(),
137
- website: z.string().url().nullable(),
138
- xProfile: z.string().url().nullable(),
136
+ github: z.string().url().nullish(),
137
+ website: z.string().url().nullish(),
138
+ xProfile: z.string().url().nullish(),
139
139
  });
140
140
  }
141
141
  export function VetraBuilderSpaceSchema() {
142
142
  return z.object({
143
143
  __typename: z.literal("VetraBuilderSpace").optional(),
144
- description: z.string().nullable(),
144
+ description: z.string().nullish(),
145
145
  id: z.string(),
146
- packages: z.array(VetraPackageInfoSchema()),
146
+ packages: z.array(z.lazy(() => VetraPackageInfoSchema())),
147
147
  title: z.string(),
148
148
  });
149
149
  }
150
150
  export function VetraPackageInfoSchema() {
151
151
  return z.object({
152
152
  __typename: z.literal("VetraPackageInfo").optional(),
153
- description: z.string().nullable(),
154
- github: z.string().nullable(),
153
+ description: z.string().nullish(),
154
+ github: z.string().nullish(),
155
155
  id: z.string(),
156
- npm: z.string().nullable(),
157
- phid: z.string().nullable(),
158
- title: z.string().nullable(),
159
- vetraDriveUrl: z.string().url().nullable(),
156
+ npm: z.string().nullish(),
157
+ phid: z.string().nullish(),
158
+ title: z.string().nullish(),
159
+ vetraDriveUrl: z.string().url().nullish(),
160
160
  });
161
161
  }
@@ -1,4 +1,4 @@
1
- import { type Action } from "document-model";
1
+ import type { Action } from "document-model";
2
2
  import type { AddSpaceInput, UpdateSpaceInfoInput, RemoveSpaceInput, ReorderSpacesInput } from "../types.js";
3
3
  export type AddSpaceAction = Action & {
4
4
  type: "ADD_SPACE";
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/gen/spaces/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG;IAC3C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IACvC,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG;IACzC,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B,cAAc,GACd,qBAAqB,GACrB,iBAAiB,GACjB,mBAAmB,CAAC"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/gen/spaces/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG;IAC3C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IACvC,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG;IACzC,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B,cAAc,GACd,qBAAqB,GACrB,iBAAiB,GACjB,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- import {} from "document-model";
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { type SignalDispatch } from "document-model";
2
- import { type AddSpaceAction, type UpdateSpaceInfoAction, type RemoveSpaceAction, type ReorderSpacesAction } from "./actions.js";
3
- import { type BuilderTeamState } from "../types.js";
2
+ import type { AddSpaceAction, UpdateSpaceInfoAction, RemoveSpaceAction, ReorderSpacesAction } from "./actions.js";
3
+ import type { BuilderTeamState } from "../types.js";
4
4
  export interface BuilderTeamSpacesOperations {
5
5
  addSpaceOperation: (state: BuilderTeamState, action: AddSpaceAction, dispatch?: SignalDispatch) => void;
6
6
  updateSpaceInfoOperation: (state: BuilderTeamState, action: UpdateSpaceInfoAction, dispatch?: SignalDispatch) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/gen/spaces/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,2BAA2B;IAC1C,iBAAiB,EAAE,CACjB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;IACV,wBAAwB,EAAE,CACxB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;IACV,oBAAoB,EAAE,CACpB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;IACV,sBAAsB,EAAE,CACtB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;CACX"}
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/gen/spaces/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,2BAA2B;IAC1C,iBAAiB,EAAE,CACjB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;IACV,wBAAwB,EAAE,CACxB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;IACV,oBAAoB,EAAE,CACpB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;IACV,sBAAsB,EAAE,CACtB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,CAAC,EAAE,cAAc,KACtB,IAAI,CAAC;CACX"}
@@ -1,3 +1 @@
1
1
  import {} from "document-model";
2
- import {} from "./actions.js";
3
- import {} from "../types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../document-models/builder-team/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEpF,KAAK,qBAAqB,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACxD,KAAK,kBAAkB,GAAG,WAAW,GAAG;IACtC,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AACF,KAAK,mBAAmB,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAE1D,cAAc,mBAAmB,CAAC;AAElC,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../document-models/builder-team/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEpF,KAAK,qBAAqB,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAExD,KAAK,kBAAkB,GAAG,WAAW,GAAG;IACtC,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AACF,KAAK,mBAAmB,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAE1D,cAAc,mBAAmB,CAAC;AAElC,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,CAAC"}
@@ -1,7 +1,3 @@
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
1
  export * from "./gen/index.js";
6
2
  export * from "./src/index.js";
7
3
  export * from "./hooks.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/builder-team/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/builder-team/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"}
@@ -1,7 +1,3 @@
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
1
  export * from "./gen/index.js";
6
2
  export * from "./src/index.js";
7
3
  export * from "./hooks.js";
@@ -1 +1 @@
1
- {"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/reducers/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAErH,eAAO,MAAM,2BAA2B,EAAE,2BAiCzC,CAAC"}
1
+ {"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/reducers/member.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAErH,eAAO,MAAM,2BAA2B,EAAE,2BAoCzC,CAAC"}
@@ -18,7 +18,10 @@ export const builderTeamMemberOperations = {
18
18
  if (memberIndex === -1) {
19
19
  return;
20
20
  }
21
- state.members[memberIndex] = { ...state.members[memberIndex], ...action.input };
21
+ state.members[memberIndex] = {
22
+ ...state.members[memberIndex],
23
+ ...action.input,
24
+ };
22
25
  },
23
26
  removeMemberOperation(state, action) {
24
27
  const memberIndex = state.members.findIndex((member) => member.id === action.input.id);
@@ -1 +1 @@
1
- {"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/reducers/packages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAKvH,eAAO,MAAM,6BAA6B,EAAE,6BAoE3C,CAAC"}
1
+ {"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/reducers/packages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAKvH,eAAO,MAAM,6BAA6B,EAAE,6BAwE3C,CAAC"}
@@ -43,13 +43,13 @@ export const builderTeamPackagesOperations = {
43
43
  reorderPackagesOperation(state, action) {
44
44
  const { spaceId, packageIds, targetIndex } = action.input;
45
45
  // Find the space
46
- const space = state.spaces.find(s => s.id === spaceId);
46
+ const space = state.spaces.find((s) => s.id === spaceId);
47
47
  if (!space) {
48
48
  return;
49
49
  }
50
50
  // Find the packages to move
51
- const packagesToMove = space.packages.filter(pkg => packageIds.includes(pkg.id));
52
- const remainingPackages = space.packages.filter(pkg => !packageIds.includes(pkg.id));
51
+ const packagesToMove = space.packages.filter((pkg) => packageIds.includes(pkg.id));
52
+ const remainingPackages = space.packages.filter((pkg) => !packageIds.includes(pkg.id));
53
53
  // Insert the packages at the target index
54
54
  remainingPackages.splice(targetIndex, 0, ...packagesToMove);
55
55
  space.packages = remainingPackages;
@@ -1 +1 @@
1
- {"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/reducers/spaces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAKrH,eAAO,MAAM,2BAA2B,EAAE,2BA+CzC,CAAC"}
1
+ {"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/reducers/spaces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAKrH,eAAO,MAAM,2BAA2B,EAAE,2BAmDzC,CAAC"}
@@ -37,8 +37,8 @@ export const builderTeamSpacesOperations = {
37
37
  reorderSpacesOperation(state, action) {
38
38
  const { spaceIds, targetIndex } = action.input;
39
39
  // Find the spaces to move
40
- const spacesToMove = state.spaces.filter(space => spaceIds.includes(space.id));
41
- const remainingSpaces = state.spaces.filter(space => !spaceIds.includes(space.id));
40
+ const spacesToMove = state.spaces.filter((space) => spaceIds.includes(space.id));
41
+ const remainingSpaces = state.spaces.filter((space) => !spaceIds.includes(space.id));
42
42
  // Insert the spaces at the target index
43
43
  remainingSpaces.splice(targetIndex, 0, ...spacesToMove);
44
44
  state.spaces = remainingSpaces;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
1
5
  /**
2
6
  * This is a scaffold file meant for customization:
3
7
  * - change it by adding new tests or modifying the existing ones
@@ -1 +1 @@
1
- {"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
1
+ {"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;GAGG"}
@@ -1,19 +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
+ */
1
5
  /**
2
6
  * This is a scaffold file meant for customization:
3
7
  * - change it by adding new tests or modifying the existing ones
4
8
  */
5
9
  import { describe, it, expect } from "vitest";
6
- import { initialGlobalState, initialLocalState } from "../../gen/utils.js";
7
- import { utils } from "../../utils.js";
8
- describe("Builder Team Document Model", () => {
9
- it("should create a new Builder Team document", () => {
10
+ import { utils, initialGlobalState, initialLocalState, builderTeamDocumentType, isBuilderTeamDocument, assertIsBuilderTeamDocument, isBuilderTeamState, assertIsBuilderTeamState, } from "@powerhousedao/vetra-builder-package/document-models/builder-team";
11
+ import { ZodError } from "zod";
12
+ describe("BuilderTeam Document Model", () => {
13
+ it("should create a new BuilderTeam document", () => {
10
14
  const document = utils.createDocument();
11
15
  expect(document).toBeDefined();
12
- expect(document.header.documentType).toBe("powerhouse/builder-team");
16
+ expect(document.header.documentType).toBe(builderTeamDocumentType);
13
17
  });
14
- it("should create a new Builder Team document with a valid initial state", () => {
18
+ it("should create a new BuilderTeam document with a valid initial state", () => {
15
19
  const document = utils.createDocument();
16
20
  expect(document.state.global).toStrictEqual(initialGlobalState);
17
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
+ }
18
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
+ }
19
104
  });
@@ -1,6 +1,2 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - change it by adding new tests or modifying the existing ones
4
- */
5
1
  export {};
6
2
  //# sourceMappingURL=member.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"member.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/member.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
1
+ {"version":3,"file":"member.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/member.test.ts"],"names":[],"mappings":""}
@@ -1,37 +1,32 @@
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
1
  import { generateMock } from "@powerhousedao/codegen";
7
- import { AddMemberInputSchema, RemoveMemberInputSchema, UpdateMemberInfoInputSchema, } from "../../gen/schema/index.js";
8
- import { reducer } from "../../gen/reducer.js";
9
- import * as creators from "../../gen/member/creators.js";
10
- import { utils } from "../../utils.js";
11
- describe("Member Operations", () => {
12
- let document;
13
- beforeEach(() => {
14
- document = utils.createDocument();
15
- });
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";
4
+ describe("MemberOperations", () => {
16
5
  it("should handle addMember operation", () => {
6
+ const document = utils.createDocument();
17
7
  const input = generateMock(AddMemberInputSchema());
18
- const updatedDocument = reducer(document, creators.addMember(input));
8
+ const updatedDocument = reducer(document, addMember(input));
9
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
19
10
  expect(updatedDocument.operations.global).toHaveLength(1);
20
11
  expect(updatedDocument.operations.global[0].action.type).toBe("ADD_MEMBER");
21
12
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
22
13
  expect(updatedDocument.operations.global[0].index).toEqual(0);
23
14
  });
24
15
  it("should handle updateMemberInfo operation", () => {
16
+ const document = utils.createDocument();
25
17
  const input = generateMock(UpdateMemberInfoInputSchema());
26
- const updatedDocument = reducer(document, creators.updateMemberInfo(input));
18
+ const updatedDocument = reducer(document, updateMemberInfo(input));
19
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
27
20
  expect(updatedDocument.operations.global).toHaveLength(1);
28
21
  expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_MEMBER_INFO");
29
22
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
30
23
  expect(updatedDocument.operations.global[0].index).toEqual(0);
31
24
  });
32
25
  it("should handle removeMember operation", () => {
26
+ const document = utils.createDocument();
33
27
  const input = generateMock(RemoveMemberInputSchema());
34
- const updatedDocument = reducer(document, creators.removeMember(input));
28
+ const updatedDocument = reducer(document, removeMember(input));
29
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
35
30
  expect(updatedDocument.operations.global).toHaveLength(1);
36
31
  expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_MEMBER");
37
32
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
@@ -1,6 +1,2 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - change it by adding new tests or modifying the existing ones
4
- */
5
1
  export {};
6
2
  //# sourceMappingURL=packages.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packages.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/packages.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
1
+ {"version":3,"file":"packages.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/packages.test.ts"],"names":[],"mappings":""}
@@ -1,40 +1,45 @@
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
1
  import { generateMock } from "@powerhousedao/codegen";
7
- import { AddPackageInputSchema, RemovePackageInputSchema, UpdatePackageInfoInputSchema, } from "../../gen/schema/index.js";
8
- import { reducer } from "../../gen/reducer.js";
9
- import * as creators from "../../gen/packages/creators.js";
10
- import { utils } from "../../utils.js";
11
- describe("Packages Operations", () => {
12
- let document;
13
- beforeEach(() => {
14
- document = utils.createDocument();
15
- });
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";
4
+ describe("PackagesOperations", () => {
16
5
  it("should handle addPackage operation", () => {
6
+ const document = utils.createDocument();
17
7
  const input = generateMock(AddPackageInputSchema());
18
- const updatedDocument = reducer(document, creators.addPackage(input));
8
+ const updatedDocument = reducer(document, addPackage(input));
9
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
19
10
  expect(updatedDocument.operations.global).toHaveLength(1);
20
11
  expect(updatedDocument.operations.global[0].action.type).toBe("ADD_PACKAGE");
21
12
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
22
13
  expect(updatedDocument.operations.global[0].index).toEqual(0);
23
14
  });
24
15
  it("should handle updatePackageInfo operation", () => {
16
+ const document = utils.createDocument();
25
17
  const input = generateMock(UpdatePackageInfoInputSchema());
26
- const updatedDocument = reducer(document, creators.updatePackageInfo(input));
18
+ const updatedDocument = reducer(document, updatePackageInfo(input));
19
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
27
20
  expect(updatedDocument.operations.global).toHaveLength(1);
28
21
  expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_PACKAGE_INFO");
29
22
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
30
23
  expect(updatedDocument.operations.global[0].index).toEqual(0);
31
24
  });
32
25
  it("should handle removePackage operation", () => {
26
+ const document = utils.createDocument();
33
27
  const input = generateMock(RemovePackageInputSchema());
34
- const updatedDocument = reducer(document, creators.removePackage(input));
28
+ const updatedDocument = reducer(document, removePackage(input));
29
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
35
30
  expect(updatedDocument.operations.global).toHaveLength(1);
36
31
  expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_PACKAGE");
37
32
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
38
33
  expect(updatedDocument.operations.global[0].index).toEqual(0);
39
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
+ });
40
45
  });
@@ -1,6 +1,2 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - change it by adding new tests or modifying the existing ones
4
- */
5
1
  export {};
6
2
  //# sourceMappingURL=profile.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/profile.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
1
+ {"version":3,"file":"profile.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/profile.test.ts"],"names":[],"mappings":""}
@@ -1,53 +1,52 @@
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
1
  import { generateMock } from "@powerhousedao/codegen";
7
- import { SetDescriptionInputSchema, SetLogoInputSchema, SetSlugInputSchema, SetSocialsInputSchema, SetTeamNameInputSchema, } from "../../gen/schema/index.js";
8
- import { reducer } from "../../gen/reducer.js";
9
- import * as creators from "../../gen/profile/creators.js";
10
- import { utils } from "../../utils.js";
11
- describe("Profile Operations", () => {
12
- let document;
13
- beforeEach(() => {
14
- document = utils.createDocument();
15
- });
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";
4
+ describe("ProfileOperations", () => {
16
5
  it("should handle setLogo operation", () => {
6
+ const document = utils.createDocument();
17
7
  const input = generateMock(SetLogoInputSchema());
18
- const updatedDocument = reducer(document, creators.setLogo(input));
8
+ const updatedDocument = reducer(document, setLogo(input));
9
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
19
10
  expect(updatedDocument.operations.global).toHaveLength(1);
20
11
  expect(updatedDocument.operations.global[0].action.type).toBe("SET_LOGO");
21
12
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
22
13
  expect(updatedDocument.operations.global[0].index).toEqual(0);
23
14
  });
24
15
  it("should handle setTeamName operation", () => {
16
+ const document = utils.createDocument();
25
17
  const input = generateMock(SetTeamNameInputSchema());
26
- const updatedDocument = reducer(document, creators.setTeamName(input));
18
+ const updatedDocument = reducer(document, setTeamName(input));
19
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
27
20
  expect(updatedDocument.operations.global).toHaveLength(1);
28
21
  expect(updatedDocument.operations.global[0].action.type).toBe("SET_TEAM_NAME");
29
22
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
30
23
  expect(updatedDocument.operations.global[0].index).toEqual(0);
31
24
  });
32
25
  it("should handle setSlug operation", () => {
26
+ const document = utils.createDocument();
33
27
  const input = generateMock(SetSlugInputSchema());
34
- const updatedDocument = reducer(document, creators.setSlug(input));
28
+ const updatedDocument = reducer(document, setSlug(input));
29
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
35
30
  expect(updatedDocument.operations.global).toHaveLength(1);
36
31
  expect(updatedDocument.operations.global[0].action.type).toBe("SET_SLUG");
37
32
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
38
33
  expect(updatedDocument.operations.global[0].index).toEqual(0);
39
34
  });
40
35
  it("should handle setDescription operation", () => {
36
+ const document = utils.createDocument();
41
37
  const input = generateMock(SetDescriptionInputSchema());
42
- const updatedDocument = reducer(document, creators.setDescription(input));
38
+ const updatedDocument = reducer(document, setDescription(input));
39
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
43
40
  expect(updatedDocument.operations.global).toHaveLength(1);
44
41
  expect(updatedDocument.operations.global[0].action.type).toBe("SET_DESCRIPTION");
45
42
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
46
43
  expect(updatedDocument.operations.global[0].index).toEqual(0);
47
44
  });
48
45
  it("should handle setSocials operation", () => {
46
+ const document = utils.createDocument();
49
47
  const input = generateMock(SetSocialsInputSchema());
50
- const updatedDocument = reducer(document, creators.setSocials(input));
48
+ const updatedDocument = reducer(document, setSocials(input));
49
+ expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
51
50
  expect(updatedDocument.operations.global).toHaveLength(1);
52
51
  expect(updatedDocument.operations.global[0].action.type).toBe("SET_SOCIALS");
53
52
  expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
@@ -1,6 +1,2 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - change it by adding new tests or modifying the existing ones
4
- */
5
1
  export {};
6
2
  //# sourceMappingURL=spaces.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spaces.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/spaces.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
1
+ {"version":3,"file":"spaces.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/spaces.test.ts"],"names":[],"mappings":""}