@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,78 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
defineEntity,
|
|
5
|
-
defineEntityEnum,
|
|
6
|
-
field,
|
|
7
|
-
index
|
|
8
|
-
} from "@contractspec/lib.schema";
|
|
9
|
-
var ProjectStatusEnum = defineEntityEnum({
|
|
10
|
-
name: "ProjectStatus",
|
|
11
|
-
values: ["DRAFT", "ACTIVE", "ARCHIVED", "DELETED"],
|
|
12
|
-
schema: "saas_app",
|
|
13
|
-
description: "Status of a project."
|
|
14
|
-
});
|
|
15
|
-
var ProjectEntity = defineEntity({
|
|
16
|
-
name: "Project",
|
|
17
|
-
description: "A project belonging to an organization.",
|
|
18
|
-
schema: "saas_app",
|
|
19
|
-
map: "project",
|
|
20
|
-
fields: {
|
|
21
|
-
id: field.id({ description: "Unique project ID" }),
|
|
22
|
-
name: field.string({ description: "Project name" }),
|
|
23
|
-
description: field.string({
|
|
24
|
-
isOptional: true,
|
|
25
|
-
description: "Project description"
|
|
26
|
-
}),
|
|
27
|
-
slug: field.string({
|
|
28
|
-
isOptional: true,
|
|
29
|
-
description: "URL-friendly identifier"
|
|
30
|
-
}),
|
|
31
|
-
organizationId: field.foreignKey({ description: "Owning organization" }),
|
|
32
|
-
createdBy: field.foreignKey({
|
|
33
|
-
description: "User who created the project"
|
|
34
|
-
}),
|
|
35
|
-
status: field.enum("ProjectStatus", { default: "DRAFT" }),
|
|
36
|
-
isPublic: field.boolean({
|
|
37
|
-
default: false,
|
|
38
|
-
description: "Whether project is publicly visible"
|
|
39
|
-
}),
|
|
40
|
-
settings: field.json({
|
|
41
|
-
isOptional: true,
|
|
42
|
-
description: "Project-specific settings"
|
|
43
|
-
}),
|
|
44
|
-
tags: field.string({ isArray: true, description: "Project tags" }),
|
|
45
|
-
metadata: field.json({ isOptional: true }),
|
|
46
|
-
createdAt: field.createdAt(),
|
|
47
|
-
updatedAt: field.updatedAt(),
|
|
48
|
-
archivedAt: field.dateTime({ isOptional: true })
|
|
49
|
-
},
|
|
50
|
-
indexes: [
|
|
51
|
-
index.on(["organizationId", "status"]),
|
|
52
|
-
index.on(["organizationId", "createdAt"]),
|
|
53
|
-
index.unique(["organizationId", "slug"])
|
|
54
|
-
],
|
|
55
|
-
enums: [ProjectStatusEnum]
|
|
56
|
-
});
|
|
57
|
-
var ProjectMemberEntity = defineEntity({
|
|
58
|
-
name: "ProjectMember",
|
|
59
|
-
description: "User access to a specific project.",
|
|
60
|
-
schema: "saas_app",
|
|
61
|
-
map: "project_member",
|
|
62
|
-
fields: {
|
|
63
|
-
id: field.id(),
|
|
64
|
-
projectId: field.foreignKey(),
|
|
65
|
-
userId: field.foreignKey(),
|
|
66
|
-
role: field.string({
|
|
67
|
-
description: "Role in project (owner, editor, viewer)"
|
|
68
|
-
}),
|
|
69
|
-
addedBy: field.string({ isOptional: true }),
|
|
70
|
-
createdAt: field.createdAt()
|
|
71
|
-
},
|
|
72
|
-
indexes: [index.unique(["projectId", "userId"])]
|
|
73
|
-
});
|
|
74
|
-
export {
|
|
75
|
-
ProjectStatusEnum,
|
|
76
|
-
ProjectMemberEntity,
|
|
77
|
-
ProjectEntity
|
|
78
|
-
};
|
|
2
|
+
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,19 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
4
|
-
var ProjectStatusSchemaEnum = defineEnum("ProjectStatus", [
|
|
5
|
-
"DRAFT",
|
|
6
|
-
"ACTIVE",
|
|
7
|
-
"ARCHIVED",
|
|
8
|
-
"DELETED"
|
|
9
|
-
]);
|
|
10
|
-
var ProjectStatusFilterEnum = defineEnum("ProjectStatusFilter", [
|
|
11
|
-
"DRAFT",
|
|
12
|
-
"ACTIVE",
|
|
13
|
-
"ARCHIVED",
|
|
14
|
-
"all"
|
|
15
|
-
]);
|
|
16
|
-
export {
|
|
17
|
-
ProjectStatusSchemaEnum,
|
|
18
|
-
ProjectStatusFilterEnum
|
|
19
|
-
};
|
|
2
|
+
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,104 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
5
|
-
var ProjectCreatedPayload = defineSchemaModel({
|
|
6
|
-
name: "ProjectCreatedPayload",
|
|
7
|
-
description: "Payload when a project is created",
|
|
8
|
-
fields: {
|
|
9
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
-
organizationId: {
|
|
12
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
13
|
-
isOptional: false
|
|
14
|
-
},
|
|
15
|
-
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
16
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
var ProjectUpdatedPayload = defineSchemaModel({
|
|
20
|
-
name: "ProjectUpdatedPayload",
|
|
21
|
-
description: "Payload when a project is updated",
|
|
22
|
-
fields: {
|
|
23
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
-
updatedFields: {
|
|
25
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
-
isArray: true,
|
|
27
|
-
isOptional: false
|
|
28
|
-
},
|
|
29
|
-
updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
-
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
var ProjectDeletedPayload = defineSchemaModel({
|
|
34
|
-
name: "ProjectDeletedPayload",
|
|
35
|
-
description: "Payload when a project is deleted",
|
|
36
|
-
fields: {
|
|
37
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
-
organizationId: {
|
|
39
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
-
isOptional: false
|
|
41
|
-
},
|
|
42
|
-
deletedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
-
deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
var ProjectArchivedPayload = defineSchemaModel({
|
|
47
|
-
name: "ProjectArchivedPayload",
|
|
48
|
-
description: "Payload when a project is archived",
|
|
49
|
-
fields: {
|
|
50
|
-
projectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
51
|
-
archivedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
52
|
-
archivedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
var ProjectCreatedEvent = defineEvent({
|
|
56
|
-
meta: {
|
|
57
|
-
key: "project.created",
|
|
58
|
-
version: "1.0.0",
|
|
59
|
-
description: "A new project has been created.",
|
|
60
|
-
stability: "stable",
|
|
61
|
-
owners: ["@saas-team"],
|
|
62
|
-
tags: ["project", "created"]
|
|
63
|
-
},
|
|
64
|
-
payload: ProjectCreatedPayload
|
|
65
|
-
});
|
|
66
|
-
var ProjectUpdatedEvent = defineEvent({
|
|
67
|
-
meta: {
|
|
68
|
-
key: "project.updated",
|
|
69
|
-
version: "1.0.0",
|
|
70
|
-
description: "A project has been updated.",
|
|
71
|
-
stability: "stable",
|
|
72
|
-
owners: ["@saas-team"],
|
|
73
|
-
tags: ["project", "updated"]
|
|
74
|
-
},
|
|
75
|
-
payload: ProjectUpdatedPayload
|
|
76
|
-
});
|
|
77
|
-
var ProjectDeletedEvent = defineEvent({
|
|
78
|
-
meta: {
|
|
79
|
-
key: "project.deleted",
|
|
80
|
-
version: "1.0.0",
|
|
81
|
-
description: "A project has been deleted.",
|
|
82
|
-
stability: "stable",
|
|
83
|
-
owners: ["@saas-team"],
|
|
84
|
-
tags: ["project", "deleted"]
|
|
85
|
-
},
|
|
86
|
-
payload: ProjectDeletedPayload
|
|
87
|
-
});
|
|
88
|
-
var ProjectArchivedEvent = defineEvent({
|
|
89
|
-
meta: {
|
|
90
|
-
key: "project.archived",
|
|
91
|
-
version: "1.0.0",
|
|
92
|
-
description: "A project has been archived.",
|
|
93
|
-
stability: "stable",
|
|
94
|
-
owners: ["@saas-team"],
|
|
95
|
-
tags: ["project", "archived"]
|
|
96
|
-
},
|
|
97
|
-
payload: ProjectArchivedPayload
|
|
98
|
-
});
|
|
99
|
-
export {
|
|
100
|
-
ProjectUpdatedEvent,
|
|
101
|
-
ProjectDeletedEvent,
|
|
102
|
-
ProjectCreatedEvent,
|
|
103
|
-
ProjectArchivedEvent
|
|
104
|
-
};
|
|
2
|
+
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,179 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
var MOCK_PROJECTS = [
|
|
4
|
-
{
|
|
5
|
-
id: "proj-1",
|
|
6
|
-
name: "Marketing Website",
|
|
7
|
-
description: "Main company website redesign project",
|
|
8
|
-
slug: "marketing-website",
|
|
9
|
-
organizationId: "demo-org",
|
|
10
|
-
createdBy: "user-1",
|
|
11
|
-
status: "ACTIVE",
|
|
12
|
-
isPublic: false,
|
|
13
|
-
tags: ["marketing", "website", "redesign"],
|
|
14
|
-
createdAt: new Date("2024-01-15T10:00:00Z"),
|
|
15
|
-
updatedAt: new Date("2024-03-20T14:30:00Z")
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
id: "proj-2",
|
|
19
|
-
name: "Mobile App v2",
|
|
20
|
-
description: "Next generation mobile application",
|
|
21
|
-
slug: "mobile-app-v2",
|
|
22
|
-
organizationId: "demo-org",
|
|
23
|
-
createdBy: "user-2",
|
|
24
|
-
status: "ACTIVE",
|
|
25
|
-
isPublic: false,
|
|
26
|
-
tags: ["mobile", "app", "v2"],
|
|
27
|
-
createdAt: new Date("2024-02-01T09:00:00Z"),
|
|
28
|
-
updatedAt: new Date("2024-04-05T11:15:00Z")
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "proj-3",
|
|
32
|
-
name: "API Integration",
|
|
33
|
-
description: "Third-party API integration project",
|
|
34
|
-
slug: "api-integration",
|
|
35
|
-
organizationId: "demo-org",
|
|
36
|
-
createdBy: "user-1",
|
|
37
|
-
status: "DRAFT",
|
|
38
|
-
isPublic: false,
|
|
39
|
-
tags: ["api", "integration"],
|
|
40
|
-
createdAt: new Date("2024-03-10T08:00:00Z"),
|
|
41
|
-
updatedAt: new Date("2024-03-10T08:00:00Z")
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "proj-4",
|
|
45
|
-
name: "Analytics Dashboard",
|
|
46
|
-
description: "Internal analytics and reporting dashboard",
|
|
47
|
-
slug: "analytics-dashboard",
|
|
48
|
-
organizationId: "demo-org",
|
|
49
|
-
createdBy: "user-3",
|
|
50
|
-
status: "ARCHIVED",
|
|
51
|
-
isPublic: true,
|
|
52
|
-
tags: ["analytics", "dashboard", "reporting"],
|
|
53
|
-
createdAt: new Date("2023-10-01T12:00:00Z"),
|
|
54
|
-
updatedAt: new Date("2024-02-28T16:45:00Z")
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
var MOCK_SUBSCRIPTION = {
|
|
58
|
-
id: "sub-1",
|
|
59
|
-
organizationId: "demo-org",
|
|
60
|
-
planId: "pro",
|
|
61
|
-
planName: "Professional",
|
|
62
|
-
status: "ACTIVE",
|
|
63
|
-
currentPeriodStart: new Date("2024-04-01T00:00:00Z"),
|
|
64
|
-
currentPeriodEnd: new Date("2024-05-01T00:00:00Z"),
|
|
65
|
-
limits: {
|
|
66
|
-
projects: 25,
|
|
67
|
-
users: 10,
|
|
68
|
-
storage: 50,
|
|
69
|
-
apiCalls: 1e5
|
|
70
|
-
},
|
|
71
|
-
usage: {
|
|
72
|
-
projects: 4,
|
|
73
|
-
users: 5,
|
|
74
|
-
storage: 12.5,
|
|
75
|
-
apiCalls: 45230
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var MOCK_USAGE_SUMMARY = {
|
|
79
|
-
organizationId: "demo-org",
|
|
80
|
-
period: "current_month",
|
|
81
|
-
apiCalls: {
|
|
82
|
-
total: 45230,
|
|
83
|
-
limit: 1e5,
|
|
84
|
-
percentUsed: 45.23
|
|
85
|
-
},
|
|
86
|
-
storage: {
|
|
87
|
-
totalGb: 12.5,
|
|
88
|
-
limitGb: 50,
|
|
89
|
-
percentUsed: 25
|
|
90
|
-
},
|
|
91
|
-
activeProjects: 4,
|
|
92
|
-
activeUsers: 5,
|
|
93
|
-
breakdown: [
|
|
94
|
-
{ date: "2024-04-01", apiCalls: 3200, storageGb: 12.1 },
|
|
95
|
-
{ date: "2024-04-02", apiCalls: 2800, storageGb: 12.2 },
|
|
96
|
-
{ date: "2024-04-03", apiCalls: 4100, storageGb: 12.3 },
|
|
97
|
-
{ date: "2024-04-04", apiCalls: 3600, storageGb: 12.4 },
|
|
98
|
-
{ date: "2024-04-05", apiCalls: 3800, storageGb: 12.5 }
|
|
99
|
-
]
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// src/project/project.handler.ts
|
|
103
|
-
async function mockListProjectsHandler(input) {
|
|
104
|
-
const { status, search, limit = 20, offset = 0 } = input;
|
|
105
|
-
let filtered = [...MOCK_PROJECTS];
|
|
106
|
-
if (status && status !== "all") {
|
|
107
|
-
filtered = filtered.filter((p) => p.status === status);
|
|
108
|
-
}
|
|
109
|
-
if (search) {
|
|
110
|
-
const q = search.toLowerCase();
|
|
111
|
-
filtered = filtered.filter((p) => p.name.toLowerCase().includes(q) || p.description?.toLowerCase().includes(q) || p.tags.some((t) => t.toLowerCase().includes(q)));
|
|
112
|
-
}
|
|
113
|
-
filtered.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
114
|
-
const total = filtered.length;
|
|
115
|
-
const projects = filtered.slice(offset, offset + limit);
|
|
116
|
-
return {
|
|
117
|
-
projects,
|
|
118
|
-
total
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
async function mockGetProjectHandler(input) {
|
|
122
|
-
const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
|
|
123
|
-
if (!project) {
|
|
124
|
-
throw new Error("NOT_FOUND");
|
|
125
|
-
}
|
|
126
|
-
return project;
|
|
127
|
-
}
|
|
128
|
-
async function mockCreateProjectHandler(input, context) {
|
|
129
|
-
if (input.slug) {
|
|
130
|
-
const exists = MOCK_PROJECTS.some((p) => p.slug === input.slug);
|
|
131
|
-
if (exists) {
|
|
132
|
-
throw new Error("SLUG_EXISTS");
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const now = new Date;
|
|
136
|
-
return {
|
|
137
|
-
id: `proj-${Date.now()}`,
|
|
138
|
-
name: input.name,
|
|
139
|
-
description: input.description,
|
|
140
|
-
slug: input.slug ?? input.name.toLowerCase().replace(/\s+/g, "-"),
|
|
141
|
-
organizationId: context.organizationId,
|
|
142
|
-
createdBy: context.userId,
|
|
143
|
-
status: "DRAFT",
|
|
144
|
-
isPublic: input.isPublic ?? false,
|
|
145
|
-
tags: input.tags ?? [],
|
|
146
|
-
createdAt: now,
|
|
147
|
-
updatedAt: now
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
async function mockUpdateProjectHandler(input) {
|
|
151
|
-
const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
|
|
152
|
-
if (!project) {
|
|
153
|
-
throw new Error("NOT_FOUND");
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
...project,
|
|
157
|
-
name: input.name ?? project.name,
|
|
158
|
-
description: input.description ?? project.description,
|
|
159
|
-
slug: input.slug ?? project.slug,
|
|
160
|
-
isPublic: input.isPublic ?? project.isPublic,
|
|
161
|
-
tags: input.tags ?? project.tags,
|
|
162
|
-
status: input.status ?? project.status,
|
|
163
|
-
updatedAt: new Date
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
async function mockDeleteProjectHandler(input) {
|
|
167
|
-
const project = MOCK_PROJECTS.find((p) => p.id === input.projectId);
|
|
168
|
-
if (!project) {
|
|
169
|
-
throw new Error("NOT_FOUND");
|
|
170
|
-
}
|
|
171
|
-
return { success: true };
|
|
172
|
-
}
|
|
173
|
-
export {
|
|
174
|
-
mockUpdateProjectHandler,
|
|
175
|
-
mockListProjectsHandler,
|
|
176
|
-
mockGetProjectHandler,
|
|
177
|
-
mockDeleteProjectHandler,
|
|
178
|
-
mockCreateProjectHandler
|
|
179
|
-
};
|
|
2
|
+
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};
|