@contractspec/example.saas-boilerplate 3.8.8 → 3.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +156 -156
- package/CHANGELOG.md +40 -0
- package/dist/billing/billing.entity.js +1 -113
- package/dist/billing/billing.enum.js +1 -19
- package/dist/billing/billing.event.js +1 -90
- package/dist/billing/billing.handler.js +1 -148
- package/dist/billing/billing.operations.js +1 -278
- package/dist/billing/billing.presentation.js +1 -55
- package/dist/billing/billing.schema.js +1 -121
- package/dist/billing/index.js +1 -691
- package/dist/browser/billing/billing.entity.js +1 -113
- package/dist/browser/billing/billing.enum.js +1 -19
- package/dist/browser/billing/billing.event.js +1 -90
- package/dist/browser/billing/billing.handler.js +1 -148
- package/dist/browser/billing/billing.operations.js +1 -278
- package/dist/browser/billing/billing.presentation.js +1 -55
- package/dist/browser/billing/billing.schema.js +1 -121
- package/dist/browser/billing/index.js +1 -691
- package/dist/browser/dashboard/dashboard.presentation.js +1 -55
- package/dist/browser/dashboard/index.js +1 -55
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/docs/saas-boilerplate.docblock.js +5 -49
- package/dist/browser/example.js +1 -39
- package/dist/browser/handlers/index.js +2 -358
- package/dist/browser/handlers/saas.handlers.js +2 -134
- package/dist/browser/index.js +9 -3591
- package/dist/browser/presentations/index.js +1 -299
- package/dist/browser/project/index.js +1 -793
- package/dist/browser/project/project.entity.js +1 -77
- package/dist/browser/project/project.enum.js +1 -18
- package/dist/browser/project/project.event.js +1 -103
- package/dist/browser/project/project.handler.js +1 -178
- package/dist/browser/project/project.operations.js +1 -372
- package/dist/browser/project/project.presentation.js +1 -180
- package/dist/browser/project/project.schema.js +1 -134
- package/dist/browser/saas-boilerplate.feature.js +1 -304
- package/dist/browser/seeders/index.js +2 -20
- package/dist/browser/settings/index.js +1 -75
- package/dist/browser/settings/settings.entity.js +1 -74
- package/dist/browser/settings/settings.enum.js +1 -11
- package/dist/browser/shared/mock-data.js +1 -104
- package/dist/browser/tests/operations.test-spec.js +1 -112
- package/dist/browser/ui/SaasDashboard.js +1 -1239
- package/dist/browser/ui/SaasDashboard.visualizations.js +1 -249
- package/dist/browser/ui/SaasProjectList.js +1 -162
- package/dist/browser/ui/SaasSettingsPanel.js +1 -145
- package/dist/browser/ui/hooks/index.js +1 -159
- package/dist/browser/ui/hooks/useProjectList.js +1 -66
- package/dist/browser/ui/hooks/useProjectMutations.js +1 -91
- package/dist/browser/ui/index.js +5 -2077
- package/dist/browser/ui/modals/CreateProjectModal.js +1 -153
- package/dist/browser/ui/modals/ProjectActionsModal.js +1 -335
- package/dist/browser/ui/modals/index.js +1 -487
- package/dist/browser/ui/overlays/demo-overlays.js +1 -61
- package/dist/browser/ui/overlays/index.js +1 -61
- package/dist/browser/ui/renderers/index.js +5 -901
- package/dist/browser/ui/renderers/project-list.markdown.js +5 -725
- package/dist/browser/ui/renderers/project-list.renderer.js +1 -177
- package/dist/browser/visualizations/catalog.js +1 -155
- package/dist/browser/visualizations/index.js +1 -217
- package/dist/browser/visualizations/selectors.js +1 -210
- package/dist/dashboard/dashboard.presentation.js +1 -55
- package/dist/dashboard/index.js +1 -55
- package/dist/docs/index.js +5 -49
- package/dist/docs/saas-boilerplate.docblock.js +5 -49
- package/dist/example.js +1 -39
- package/dist/handlers/index.js +2 -358
- package/dist/handlers/saas.handlers.js +2 -134
- package/dist/index.js +9 -3591
- package/dist/node/billing/billing.entity.js +1 -113
- package/dist/node/billing/billing.enum.js +1 -19
- package/dist/node/billing/billing.event.js +1 -90
- package/dist/node/billing/billing.handler.js +1 -148
- package/dist/node/billing/billing.operations.js +1 -278
- package/dist/node/billing/billing.presentation.js +1 -55
- package/dist/node/billing/billing.schema.js +1 -121
- package/dist/node/billing/index.js +1 -691
- package/dist/node/dashboard/dashboard.presentation.js +1 -55
- package/dist/node/dashboard/index.js +1 -55
- package/dist/node/docs/index.js +5 -49
- package/dist/node/docs/saas-boilerplate.docblock.js +5 -49
- package/dist/node/example.js +1 -39
- package/dist/node/handlers/index.js +2 -358
- package/dist/node/handlers/saas.handlers.js +2 -134
- package/dist/node/index.js +9 -3591
- package/dist/node/presentations/index.js +1 -299
- package/dist/node/project/index.js +1 -793
- package/dist/node/project/project.entity.js +1 -77
- package/dist/node/project/project.enum.js +1 -18
- package/dist/node/project/project.event.js +1 -103
- package/dist/node/project/project.handler.js +1 -178
- package/dist/node/project/project.operations.js +1 -372
- package/dist/node/project/project.presentation.js +1 -180
- package/dist/node/project/project.schema.js +1 -134
- package/dist/node/saas-boilerplate.feature.js +1 -304
- package/dist/node/seeders/index.js +2 -20
- package/dist/node/settings/index.js +1 -75
- package/dist/node/settings/settings.entity.js +1 -74
- package/dist/node/settings/settings.enum.js +1 -11
- package/dist/node/shared/mock-data.js +1 -104
- package/dist/node/tests/operations.test-spec.js +1 -112
- package/dist/node/ui/SaasDashboard.js +1 -1239
- package/dist/node/ui/SaasDashboard.visualizations.js +1 -249
- package/dist/node/ui/SaasProjectList.js +1 -162
- package/dist/node/ui/SaasSettingsPanel.js +1 -145
- package/dist/node/ui/hooks/index.js +1 -159
- package/dist/node/ui/hooks/useProjectList.js +1 -66
- package/dist/node/ui/hooks/useProjectMutations.js +1 -91
- package/dist/node/ui/index.js +5 -2077
- package/dist/node/ui/modals/CreateProjectModal.js +1 -153
- package/dist/node/ui/modals/ProjectActionsModal.js +1 -335
- package/dist/node/ui/modals/index.js +1 -487
- package/dist/node/ui/overlays/demo-overlays.js +1 -61
- package/dist/node/ui/overlays/index.js +1 -61
- package/dist/node/ui/renderers/index.js +5 -901
- package/dist/node/ui/renderers/project-list.markdown.js +5 -725
- package/dist/node/ui/renderers/project-list.renderer.js +1 -177
- package/dist/node/visualizations/catalog.js +1 -155
- package/dist/node/visualizations/index.js +1 -217
- package/dist/node/visualizations/selectors.js +1 -210
- package/dist/presentations/index.js +1 -299
- package/dist/project/index.js +1 -793
- package/dist/project/project.entity.js +1 -77
- package/dist/project/project.enum.js +1 -18
- package/dist/project/project.event.js +1 -103
- package/dist/project/project.handler.js +1 -178
- package/dist/project/project.operations.js +1 -372
- package/dist/project/project.presentation.js +1 -180
- package/dist/project/project.schema.js +1 -134
- package/dist/saas-boilerplate.feature.js +1 -304
- package/dist/seeders/index.js +2 -20
- package/dist/settings/index.js +1 -75
- package/dist/settings/settings.entity.js +1 -74
- package/dist/settings/settings.enum.js +1 -11
- package/dist/shared/mock-data.js +1 -104
- package/dist/tests/operations.test-spec.js +1 -112
- package/dist/ui/SaasDashboard.js +1 -1239
- package/dist/ui/SaasDashboard.visualizations.js +1 -249
- package/dist/ui/SaasProjectList.js +1 -162
- package/dist/ui/SaasSettingsPanel.js +1 -145
- package/dist/ui/hooks/index.js +1 -159
- package/dist/ui/hooks/useProjectList.js +1 -66
- package/dist/ui/hooks/useProjectMutations.js +1 -91
- package/dist/ui/index.js +5 -2077
- package/dist/ui/modals/CreateProjectModal.js +1 -153
- package/dist/ui/modals/ProjectActionsModal.js +1 -335
- package/dist/ui/modals/index.js +1 -487
- package/dist/ui/overlays/demo-overlays.js +1 -61
- package/dist/ui/overlays/index.js +1 -61
- package/dist/ui/renderers/index.js +5 -901
- package/dist/ui/renderers/project-list.markdown.js +5 -725
- package/dist/ui/renderers/project-list.renderer.js +1 -177
- package/dist/visualizations/catalog.js +1 -155
- package/dist/visualizations/index.js +1 -217
- package/dist/visualizations/selectors.js +1 -210
- package/package.json +15 -15
|
@@ -1,77 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
defineEntity,
|
|
4
|
-
defineEntityEnum,
|
|
5
|
-
field,
|
|
6
|
-
index
|
|
7
|
-
} from "@contractspec/lib.schema";
|
|
8
|
-
var ProjectStatusEnum = defineEntityEnum({
|
|
9
|
-
name: "ProjectStatus",
|
|
10
|
-
values: ["DRAFT", "ACTIVE", "ARCHIVED", "DELETED"],
|
|
11
|
-
schema: "saas_app",
|
|
12
|
-
description: "Status of a project."
|
|
13
|
-
});
|
|
14
|
-
var ProjectEntity = defineEntity({
|
|
15
|
-
name: "Project",
|
|
16
|
-
description: "A project belonging to an organization.",
|
|
17
|
-
schema: "saas_app",
|
|
18
|
-
map: "project",
|
|
19
|
-
fields: {
|
|
20
|
-
id: field.id({ description: "Unique project ID" }),
|
|
21
|
-
name: field.string({ description: "Project name" }),
|
|
22
|
-
description: field.string({
|
|
23
|
-
isOptional: true,
|
|
24
|
-
description: "Project description"
|
|
25
|
-
}),
|
|
26
|
-
slug: field.string({
|
|
27
|
-
isOptional: true,
|
|
28
|
-
description: "URL-friendly identifier"
|
|
29
|
-
}),
|
|
30
|
-
organizationId: field.foreignKey({ description: "Owning organization" }),
|
|
31
|
-
createdBy: field.foreignKey({
|
|
32
|
-
description: "User who created the project"
|
|
33
|
-
}),
|
|
34
|
-
status: field.enum("ProjectStatus", { default: "DRAFT" }),
|
|
35
|
-
isPublic: field.boolean({
|
|
36
|
-
default: false,
|
|
37
|
-
description: "Whether project is publicly visible"
|
|
38
|
-
}),
|
|
39
|
-
settings: field.json({
|
|
40
|
-
isOptional: true,
|
|
41
|
-
description: "Project-specific settings"
|
|
42
|
-
}),
|
|
43
|
-
tags: field.string({ isArray: true, description: "Project tags" }),
|
|
44
|
-
metadata: field.json({ isOptional: true }),
|
|
45
|
-
createdAt: field.createdAt(),
|
|
46
|
-
updatedAt: field.updatedAt(),
|
|
47
|
-
archivedAt: field.dateTime({ isOptional: true })
|
|
48
|
-
},
|
|
49
|
-
indexes: [
|
|
50
|
-
index.on(["organizationId", "status"]),
|
|
51
|
-
index.on(["organizationId", "createdAt"]),
|
|
52
|
-
index.unique(["organizationId", "slug"])
|
|
53
|
-
],
|
|
54
|
-
enums: [ProjectStatusEnum]
|
|
55
|
-
});
|
|
56
|
-
var ProjectMemberEntity = defineEntity({
|
|
57
|
-
name: "ProjectMember",
|
|
58
|
-
description: "User access to a specific project.",
|
|
59
|
-
schema: "saas_app",
|
|
60
|
-
map: "project_member",
|
|
61
|
-
fields: {
|
|
62
|
-
id: field.id(),
|
|
63
|
-
projectId: field.foreignKey(),
|
|
64
|
-
userId: field.foreignKey(),
|
|
65
|
-
role: field.string({
|
|
66
|
-
description: "Role in project (owner, editor, viewer)"
|
|
67
|
-
}),
|
|
68
|
-
addedBy: field.string({ isOptional: true }),
|
|
69
|
-
createdAt: field.createdAt()
|
|
70
|
-
},
|
|
71
|
-
indexes: [index.unique(["projectId", "userId"])]
|
|
72
|
-
});
|
|
73
|
-
export {
|
|
74
|
-
ProjectStatusEnum,
|
|
75
|
-
ProjectMemberEntity,
|
|
76
|
-
ProjectEntity
|
|
77
|
-
};
|
|
1
|
+
import{defineEntity as q,defineEntityEnum as w,field as g,index as k}from"@contractspec/lib.schema";var z=w({name:"ProjectStatus",values:["DRAFT","ACTIVE","ARCHIVED","DELETED"],schema:"saas_app",description:"Status of a project."}),B=q({name:"Project",description:"A project belonging to an organization.",schema:"saas_app",map:"project",fields:{id:g.id({description:"Unique project ID"}),name:g.string({description:"Project name"}),description:g.string({isOptional:!0,description:"Project description"}),slug:g.string({isOptional:!0,description:"URL-friendly identifier"}),organizationId:g.foreignKey({description:"Owning organization"}),createdBy:g.foreignKey({description:"User who created the project"}),status:g.enum("ProjectStatus",{default:"DRAFT"}),isPublic:g.boolean({default:!1,description:"Whether project is publicly visible"}),settings:g.json({isOptional:!0,description:"Project-specific settings"}),tags:g.string({isArray:!0,description:"Project tags"}),metadata:g.json({isOptional:!0}),createdAt:g.createdAt(),updatedAt:g.updatedAt(),archivedAt:g.dateTime({isOptional:!0})},indexes:[k.on(["organizationId","status"]),k.on(["organizationId","createdAt"]),k.unique(["organizationId","slug"])],enums:[z]}),C=q({name:"ProjectMember",description:"User access to a specific project.",schema:"saas_app",map:"project_member",fields:{id:g.id(),projectId:g.foreignKey(),userId:g.foreignKey(),role:g.string({description:"Role in project (owner, editor, viewer)"}),addedBy:g.string({isOptional:!0}),createdAt:g.createdAt()},indexes:[k.unique(["projectId","userId"])]});export{z as ProjectStatusEnum,C as ProjectMemberEntity,B as ProjectEntity};
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var ProjectStatusSchemaEnum = defineEnum("ProjectStatus", [
|
|
4
|
-
"DRAFT",
|
|
5
|
-
"ACTIVE",
|
|
6
|
-
"ARCHIVED",
|
|
7
|
-
"DELETED"
|
|
8
|
-
]);
|
|
9
|
-
var ProjectStatusFilterEnum = defineEnum("ProjectStatusFilter", [
|
|
10
|
-
"DRAFT",
|
|
11
|
-
"ACTIVE",
|
|
12
|
-
"ARCHIVED",
|
|
13
|
-
"all"
|
|
14
|
-
]);
|
|
15
|
-
export {
|
|
16
|
-
ProjectStatusSchemaEnum,
|
|
17
|
-
ProjectStatusFilterEnum
|
|
18
|
-
};
|
|
1
|
+
import{defineEnum as g}from"@contractspec/lib.schema";var q=g("ProjectStatus",["DRAFT","ACTIVE","ARCHIVED","DELETED"]),v=g("ProjectStatusFilter",["DRAFT","ACTIVE","ARCHIVED","all"]);export{q as ProjectStatusSchemaEnum,v as ProjectStatusFilterEnum};
|
|
@@ -1,103 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
|
-
var ProjectCreatedPayload = defineSchemaModel({
|
|
5
|
-
name: "ProjectCreatedPayload",
|
|
6
|
-
description: "Payload when a project is created",
|
|
7
|
-
fields: {
|
|
8
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
organizationId: {
|
|
11
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
12
|
-
isOptional: false
|
|
13
|
-
},
|
|
14
|
-
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
15
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var ProjectUpdatedPayload = defineSchemaModel({
|
|
19
|
-
name: "ProjectUpdatedPayload",
|
|
20
|
-
description: "Payload when a project is updated",
|
|
21
|
-
fields: {
|
|
22
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
-
updatedFields: {
|
|
24
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
25
|
-
isArray: true,
|
|
26
|
-
isOptional: false
|
|
27
|
-
},
|
|
28
|
-
updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
29
|
-
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
var ProjectDeletedPayload = defineSchemaModel({
|
|
33
|
-
name: "ProjectDeletedPayload",
|
|
34
|
-
description: "Payload when a project is deleted",
|
|
35
|
-
fields: {
|
|
36
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
-
organizationId: {
|
|
38
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
39
|
-
isOptional: false
|
|
40
|
-
},
|
|
41
|
-
deletedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
-
deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
var ProjectArchivedPayload = defineSchemaModel({
|
|
46
|
-
name: "ProjectArchivedPayload",
|
|
47
|
-
description: "Payload when a project is archived",
|
|
48
|
-
fields: {
|
|
49
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
50
|
-
archivedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
51
|
-
archivedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
var ProjectCreatedEvent = defineEvent({
|
|
55
|
-
meta: {
|
|
56
|
-
key: "project.created",
|
|
57
|
-
version: "1.0.0",
|
|
58
|
-
description: "A new project has been created.",
|
|
59
|
-
stability: "stable",
|
|
60
|
-
owners: ["@saas-team"],
|
|
61
|
-
tags: ["project", "created"]
|
|
62
|
-
},
|
|
63
|
-
payload: ProjectCreatedPayload
|
|
64
|
-
});
|
|
65
|
-
var ProjectUpdatedEvent = defineEvent({
|
|
66
|
-
meta: {
|
|
67
|
-
key: "project.updated",
|
|
68
|
-
version: "1.0.0",
|
|
69
|
-
description: "A project has been updated.",
|
|
70
|
-
stability: "stable",
|
|
71
|
-
owners: ["@saas-team"],
|
|
72
|
-
tags: ["project", "updated"]
|
|
73
|
-
},
|
|
74
|
-
payload: ProjectUpdatedPayload
|
|
75
|
-
});
|
|
76
|
-
var ProjectDeletedEvent = defineEvent({
|
|
77
|
-
meta: {
|
|
78
|
-
key: "project.deleted",
|
|
79
|
-
version: "1.0.0",
|
|
80
|
-
description: "A project has been deleted.",
|
|
81
|
-
stability: "stable",
|
|
82
|
-
owners: ["@saas-team"],
|
|
83
|
-
tags: ["project", "deleted"]
|
|
84
|
-
},
|
|
85
|
-
payload: ProjectDeletedPayload
|
|
86
|
-
});
|
|
87
|
-
var ProjectArchivedEvent = defineEvent({
|
|
88
|
-
meta: {
|
|
89
|
-
key: "project.archived",
|
|
90
|
-
version: "1.0.0",
|
|
91
|
-
description: "A project has been archived.",
|
|
92
|
-
stability: "stable",
|
|
93
|
-
owners: ["@saas-team"],
|
|
94
|
-
tags: ["project", "archived"]
|
|
95
|
-
},
|
|
96
|
-
payload: ProjectArchivedPayload
|
|
97
|
-
});
|
|
98
|
-
export {
|
|
99
|
-
ProjectUpdatedEvent,
|
|
100
|
-
ProjectDeletedEvent,
|
|
101
|
-
ProjectCreatedEvent,
|
|
102
|
-
ProjectArchivedEvent
|
|
103
|
-
};
|
|
1
|
+
import{defineEvent as k}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as q,ScalarTypeEnum as g}from"@contractspec/lib.schema";var w=q({name:"ProjectCreatedPayload",description:"Payload when a project is created",fields:{projectId:{type:g.String_unsecure(),isOptional:!1},name:{type:g.String_unsecure(),isOptional:!1},organizationId:{type:g.String_unsecure(),isOptional:!1},createdBy:{type:g.String_unsecure(),isOptional:!1},createdAt:{type:g.DateTime(),isOptional:!1}}}),x=q({name:"ProjectUpdatedPayload",description:"Payload when a project is updated",fields:{projectId:{type:g.String_unsecure(),isOptional:!1},updatedFields:{type:g.String_unsecure(),isArray:!0,isOptional:!1},updatedBy:{type:g.String_unsecure(),isOptional:!1},updatedAt:{type:g.DateTime(),isOptional:!1}}}),z=q({name:"ProjectDeletedPayload",description:"Payload when a project is deleted",fields:{projectId:{type:g.String_unsecure(),isOptional:!1},organizationId:{type:g.String_unsecure(),isOptional:!1},deletedBy:{type:g.String_unsecure(),isOptional:!1},deletedAt:{type:g.DateTime(),isOptional:!1}}}),B=q({name:"ProjectArchivedPayload",description:"Payload when a project is archived",fields:{projectId:{type:g.String_unsecure(),isOptional:!1},archivedBy:{type:g.String_unsecure(),isOptional:!1},archivedAt:{type:g.DateTime(),isOptional:!1}}}),H=k({meta:{key:"project.created",version:"1.0.0",description:"A new project has been created.",stability:"stable",owners:["@saas-team"],tags:["project","created"]},payload:w}),I=k({meta:{key:"project.updated",version:"1.0.0",description:"A project has been updated.",stability:"stable",owners:["@saas-team"],tags:["project","updated"]},payload:x}),J=k({meta:{key:"project.deleted",version:"1.0.0",description:"A project has been deleted.",stability:"stable",owners:["@saas-team"],tags:["project","deleted"]},payload:z}),K=k({meta:{key:"project.archived",version:"1.0.0",description:"A project has been archived.",stability:"stable",owners:["@saas-team"],tags:["project","archived"]},payload:B});export{I as ProjectUpdatedEvent,J as ProjectDeletedEvent,H as ProjectCreatedEvent,K as ProjectArchivedEvent};
|
|
@@ -1,178 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var MOCK_PROJECTS = [
|
|
3
|
-
{
|
|
4
|
-
id: "proj-1",
|
|
5
|
-
name: "Marketing Website",
|
|
6
|
-
description: "Main company website redesign project",
|
|
7
|
-
slug: "marketing-website",
|
|
8
|
-
organizationId: "demo-org",
|
|
9
|
-
createdBy: "user-1",
|
|
10
|
-
status: "ACTIVE",
|
|
11
|
-
isPublic: false,
|
|
12
|
-
tags: ["marketing", "website", "redesign"],
|
|
13
|
-
createdAt: new Date("2024-01-15T10:00:00Z"),
|
|
14
|
-
updatedAt: new Date("2024-03-20T14:30:00Z")
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: "proj-2",
|
|
18
|
-
name: "Mobile App v2",
|
|
19
|
-
description: "Next generation mobile application",
|
|
20
|
-
slug: "mobile-app-v2",
|
|
21
|
-
organizationId: "demo-org",
|
|
22
|
-
createdBy: "user-2",
|
|
23
|
-
status: "ACTIVE",
|
|
24
|
-
isPublic: false,
|
|
25
|
-
tags: ["mobile", "app", "v2"],
|
|
26
|
-
createdAt: new Date("2024-02-01T09:00:00Z"),
|
|
27
|
-
updatedAt: new Date("2024-04-05T11:15:00Z")
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: "proj-3",
|
|
31
|
-
name: "API Integration",
|
|
32
|
-
description: "Third-party API integration project",
|
|
33
|
-
slug: "api-integration",
|
|
34
|
-
organizationId: "demo-org",
|
|
35
|
-
createdBy: "user-1",
|
|
36
|
-
status: "DRAFT",
|
|
37
|
-
isPublic: false,
|
|
38
|
-
tags: ["api", "integration"],
|
|
39
|
-
createdAt: new Date("2024-03-10T08:00:00Z"),
|
|
40
|
-
updatedAt: new Date("2024-03-10T08:00:00Z")
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: "proj-4",
|
|
44
|
-
name: "Analytics Dashboard",
|
|
45
|
-
description: "Internal analytics and reporting dashboard",
|
|
46
|
-
slug: "analytics-dashboard",
|
|
47
|
-
organizationId: "demo-org",
|
|
48
|
-
createdBy: "user-3",
|
|
49
|
-
status: "ARCHIVED",
|
|
50
|
-
isPublic: true,
|
|
51
|
-
tags: ["analytics", "dashboard", "reporting"],
|
|
52
|
-
createdAt: new Date("2023-10-01T12:00:00Z"),
|
|
53
|
-
updatedAt: new Date("2024-02-28T16:45:00Z")
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
var MOCK_SUBSCRIPTION = {
|
|
57
|
-
id: "sub-1",
|
|
58
|
-
organizationId: "demo-org",
|
|
59
|
-
planId: "pro",
|
|
60
|
-
planName: "Professional",
|
|
61
|
-
status: "ACTIVE",
|
|
62
|
-
currentPeriodStart: new Date("2024-04-01T00:00:00Z"),
|
|
63
|
-
currentPeriodEnd: new Date("2024-05-01T00:00:00Z"),
|
|
64
|
-
limits: {
|
|
65
|
-
projects: 25,
|
|
66
|
-
users: 10,
|
|
67
|
-
storage: 50,
|
|
68
|
-
apiCalls: 1e5
|
|
69
|
-
},
|
|
70
|
-
usage: {
|
|
71
|
-
projects: 4,
|
|
72
|
-
users: 5,
|
|
73
|
-
storage: 12.5,
|
|
74
|
-
apiCalls: 45230
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var MOCK_USAGE_SUMMARY = {
|
|
78
|
-
organizationId: "demo-org",
|
|
79
|
-
period: "current_month",
|
|
80
|
-
apiCalls: {
|
|
81
|
-
total: 45230,
|
|
82
|
-
limit: 1e5,
|
|
83
|
-
percentUsed: 45.23
|
|
84
|
-
},
|
|
85
|
-
storage: {
|
|
86
|
-
totalGb: 12.5,
|
|
87
|
-
limitGb: 50,
|
|
88
|
-
percentUsed: 25
|
|
89
|
-
},
|
|
90
|
-
activeProjects: 4,
|
|
91
|
-
activeUsers: 5,
|
|
92
|
-
breakdown: [
|
|
93
|
-
{ date: "2024-04-01", apiCalls: 3200, storageGb: 12.1 },
|
|
94
|
-
{ date: "2024-04-02", apiCalls: 2800, storageGb: 12.2 },
|
|
95
|
-
{ date: "2024-04-03", apiCalls: 4100, storageGb: 12.3 },
|
|
96
|
-
{ date: "2024-04-04", apiCalls: 3600, storageGb: 12.4 },
|
|
97
|
-
{ date: "2024-04-05", apiCalls: 3800, storageGb: 12.5 }
|
|
98
|
-
]
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// src/project/project.handler.ts
|
|
102
|
-
async function mockListProjectsHandler(input) {
|
|
103
|
-
const { status, search, limit = 20, offset = 0 } = input;
|
|
104
|
-
let filtered = [...MOCK_PROJECTS];
|
|
105
|
-
if (status && status !== "all") {
|
|
106
|
-
filtered = filtered.filter((p) => p.status === status);
|
|
107
|
-
}
|
|
108
|
-
if (search) {
|
|
109
|
-
const q = search.toLowerCase();
|
|
110
|
-
filtered = filtered.filter((p) => p.name.toLowerCase().includes(q) || p.description?.toLowerCase().includes(q) || p.tags.some((t) => t.toLowerCase().includes(q)));
|
|
111
|
-
}
|
|
112
|
-
filtered.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
113
|
-
const total = filtered.length;
|
|
114
|
-
const projects = filtered.slice(offset, offset + limit);
|
|
115
|
-
return {
|
|
116
|
-
projects,
|
|
117
|
-
total
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
async function mockGetProjectHandler(input) {
|
|
121
|
-
const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
|
|
122
|
-
if (!project) {
|
|
123
|
-
throw new Error("NOT_FOUND");
|
|
124
|
-
}
|
|
125
|
-
return project;
|
|
126
|
-
}
|
|
127
|
-
async function mockCreateProjectHandler(input, context) {
|
|
128
|
-
if (input.slug) {
|
|
129
|
-
const exists = MOCK_PROJECTS.some((p) => p.slug === input.slug);
|
|
130
|
-
if (exists) {
|
|
131
|
-
throw new Error("SLUG_EXISTS");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const now = new Date;
|
|
135
|
-
return {
|
|
136
|
-
id: `proj-${Date.now()}`,
|
|
137
|
-
name: input.name,
|
|
138
|
-
description: input.description,
|
|
139
|
-
slug: input.slug ?? input.name.toLowerCase().replace(/\s+/g, "-"),
|
|
140
|
-
organizationId: context.organizationId,
|
|
141
|
-
createdBy: context.userId,
|
|
142
|
-
status: "DRAFT",
|
|
143
|
-
isPublic: input.isPublic ?? false,
|
|
144
|
-
tags: input.tags ?? [],
|
|
145
|
-
createdAt: now,
|
|
146
|
-
updatedAt: now
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
async function mockUpdateProjectHandler(input) {
|
|
150
|
-
const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
|
|
151
|
-
if (!project) {
|
|
152
|
-
throw new Error("NOT_FOUND");
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
...project,
|
|
156
|
-
name: input.name ?? project.name,
|
|
157
|
-
description: input.description ?? project.description,
|
|
158
|
-
slug: input.slug ?? project.slug,
|
|
159
|
-
isPublic: input.isPublic ?? project.isPublic,
|
|
160
|
-
tags: input.tags ?? project.tags,
|
|
161
|
-
status: input.status ?? project.status,
|
|
162
|
-
updatedAt: new Date
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
async function mockDeleteProjectHandler(input) {
|
|
166
|
-
const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
|
|
167
|
-
if (!project) {
|
|
168
|
-
throw new Error("NOT_FOUND");
|
|
169
|
-
}
|
|
170
|
-
return { success: true };
|
|
171
|
-
}
|
|
172
|
-
export {
|
|
173
|
-
mockUpdateProjectHandler,
|
|
174
|
-
mockListProjectsHandler,
|
|
175
|
-
mockGetProjectHandler,
|
|
176
|
-
mockDeleteProjectHandler,
|
|
177
|
-
mockCreateProjectHandler
|
|
178
|
-
};
|
|
1
|
+
var G=[{id:"proj-1",name:"Marketing Website",description:"Main company website redesign project",slug:"marketing-website",organizationId:"demo-org",createdBy:"user-1",status:"ACTIVE",isPublic:!1,tags:["marketing","website","redesign"],createdAt:new Date("2024-01-15T10:00:00Z"),updatedAt:new Date("2024-03-20T14:30:00Z")},{id:"proj-2",name:"Mobile App v2",description:"Next generation mobile application",slug:"mobile-app-v2",organizationId:"demo-org",createdBy:"user-2",status:"ACTIVE",isPublic:!1,tags:["mobile","app","v2"],createdAt:new Date("2024-02-01T09:00:00Z"),updatedAt:new Date("2024-04-05T11:15:00Z")},{id:"proj-3",name:"API Integration",description:"Third-party API integration project",slug:"api-integration",organizationId:"demo-org",createdBy:"user-1",status:"DRAFT",isPublic:!1,tags:["api","integration"],createdAt:new Date("2024-03-10T08:00:00Z"),updatedAt:new Date("2024-03-10T08:00:00Z")},{id:"proj-4",name:"Analytics Dashboard",description:"Internal analytics and reporting dashboard",slug:"analytics-dashboard",organizationId:"demo-org",createdBy:"user-3",status:"ARCHIVED",isPublic:!0,tags:["analytics","dashboard","reporting"],createdAt:new Date("2023-10-01T12:00:00Z"),updatedAt:new Date("2024-02-28T16:45:00Z")}],W={id:"sub-1",organizationId:"demo-org",planId:"pro",planName:"Professional",status:"ACTIVE",currentPeriodStart:new Date("2024-04-01T00:00:00Z"),currentPeriodEnd:new Date("2024-05-01T00:00:00Z"),limits:{projects:25,users:10,storage:50,apiCalls:1e5},usage:{projects:4,users:5,storage:12.5,apiCalls:45230}},X={organizationId:"demo-org",period:"current_month",apiCalls:{total:45230,limit:1e5,percentUsed:45.23},storage:{totalGb:12.5,limitGb:50,percentUsed:25},activeProjects:4,activeUsers:5,breakdown:[{date:"2024-04-01",apiCalls:3200,storageGb:12.1},{date:"2024-04-02",apiCalls:2800,storageGb:12.2},{date:"2024-04-03",apiCalls:4100,storageGb:12.3},{date:"2024-04-04",apiCalls:3600,storageGb:12.4},{date:"2024-04-05",apiCalls:3800,storageGb:12.5}]};async function $(v){let{status:z,search:A,limit:L=20,offset:I=0}=v,B=[...G];if(z&&z!=="all")B=B.filter((F)=>F.status===z);if(A){let F=A.toLowerCase();B=B.filter((H)=>H.name.toLowerCase().includes(F)||H.description?.toLowerCase().includes(F)||H.tags.some((Q)=>Q.toLowerCase().includes(F)))}B.sort((F,H)=>H.updatedAt.getTime()-F.updatedAt.getTime());let N=B.length;return{projects:B.slice(I,I+L),total:N}}async function g(v){let z=G.find((A)=>A.id===v.projectId);if(!z)throw Error("NOT_FOUND");return z}async function y(v,z){if(v.slug){if(G.some((I)=>I.slug===v.slug))throw Error("SLUG_EXISTS")}let A=new Date;return{id:`proj-${Date.now()}`,name:v.name,description:v.description,slug:v.slug??v.name.toLowerCase().replace(/\s+/g,"-"),organizationId:z.organizationId,createdBy:z.userId,status:"DRAFT",isPublic:v.isPublic??!1,tags:v.tags??[],createdAt:A,updatedAt:A}}async function U(v){let z=G.find((A)=>A.id===v.projectId);if(!z)throw Error("NOT_FOUND");return{...z,name:v.name??z.name,description:v.description??z.description,slug:v.slug??z.slug,isPublic:v.isPublic??z.isPublic,tags:v.tags??z.tags,status:v.status??z.status,updatedAt:new Date}}async function b(v){if(!G.find((A)=>A.id===v.projectId))throw Error("NOT_FOUND");return{success:!0}}export{U as mockUpdateProjectHandler,$ as mockListProjectsHandler,g as mockGetProjectHandler,b as mockDeleteProjectHandler,y as mockCreateProjectHandler};
|