@contractspec/example.saas-boilerplate 1.57.0 → 1.59.0
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 +160 -180
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +39 -0
- package/dist/billing/billing.entity.d.ts +40 -45
- package/dist/billing/billing.entity.d.ts.map +1 -1
- package/dist/billing/billing.entity.js +110 -118
- package/dist/billing/billing.enum.d.ts +2 -7
- package/dist/billing/billing.enum.d.ts.map +1 -1
- package/dist/billing/billing.enum.js +17 -24
- package/dist/billing/billing.event.d.ts +67 -73
- package/dist/billing/billing.event.d.ts.map +1 -1
- package/dist/billing/billing.event.js +84 -146
- package/dist/billing/billing.handler.d.ts +59 -62
- package/dist/billing/billing.handler.d.ts.map +1 -1
- package/dist/billing/billing.handler.js +140 -49
- package/dist/billing/billing.operations.d.ts +138 -144
- package/dist/billing/billing.operations.d.ts.map +1 -1
- package/dist/billing/billing.operations.js +273 -175
- package/dist/billing/billing.presentation.d.ts +2 -7
- package/dist/billing/billing.presentation.d.ts.map +1 -1
- package/dist/billing/billing.presentation.js +51 -57
- package/dist/billing/billing.schema.d.ts +159 -164
- package/dist/billing/billing.schema.d.ts.map +1 -1
- package/dist/billing/billing.schema.js +112 -204
- package/dist/billing/index.d.ts +11 -8
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +689 -9
- package/dist/browser/billing/billing.entity.js +113 -0
- package/dist/browser/billing/billing.enum.js +19 -0
- package/dist/browser/billing/billing.event.js +90 -0
- package/dist/browser/billing/billing.handler.js +148 -0
- package/dist/browser/billing/billing.operations.js +278 -0
- package/dist/browser/billing/billing.presentation.js +52 -0
- package/dist/browser/billing/billing.schema.js +121 -0
- package/dist/browser/billing/index.js +688 -0
- package/dist/browser/dashboard/dashboard.presentation.js +52 -0
- package/dist/browser/dashboard/index.js +52 -0
- package/dist/browser/docs/index.js +93 -0
- package/dist/browser/docs/saas-boilerplate.docblock.js +93 -0
- package/dist/browser/example.js +39 -0
- package/dist/browser/handlers/index.js +358 -0
- package/dist/browser/handlers/saas.handlers.js +134 -0
- package/dist/browser/index.js +3340 -0
- package/dist/browser/presentations/index.js +290 -0
- package/dist/browser/project/index.js +790 -0
- package/dist/browser/project/project.entity.js +77 -0
- package/dist/browser/project/project.enum.js +18 -0
- package/dist/browser/project/project.event.js +103 -0
- package/dist/browser/project/project.handler.js +178 -0
- package/dist/browser/project/project.operations.js +372 -0
- package/dist/browser/project/project.presentation.js +177 -0
- package/dist/browser/project/project.schema.js +134 -0
- package/dist/browser/saas-boilerplate.feature.js +88 -0
- package/dist/browser/seeders/index.js +20 -0
- package/dist/browser/settings/index.js +75 -0
- package/dist/browser/settings/settings.entity.js +74 -0
- package/dist/browser/settings/settings.enum.js +11 -0
- package/dist/browser/shared/mock-data.js +104 -0
- package/dist/browser/shared/overlay-types.js +0 -0
- package/dist/browser/tests/operations.test-spec.js +112 -0
- package/dist/browser/ui/SaasDashboard.js +988 -0
- package/dist/browser/ui/SaasProjectList.js +162 -0
- package/dist/browser/ui/SaasSettingsPanel.js +145 -0
- package/dist/browser/ui/hooks/index.js +159 -0
- package/dist/browser/ui/hooks/useProjectList.js +66 -0
- package/dist/browser/ui/hooks/useProjectMutations.js +91 -0
- package/dist/browser/ui/index.js +1808 -0
- package/dist/browser/ui/modals/CreateProjectModal.js +153 -0
- package/dist/browser/ui/modals/ProjectActionsModal.js +335 -0
- package/dist/browser/ui/modals/index.js +487 -0
- package/dist/browser/ui/overlays/demo-overlays.js +61 -0
- package/dist/browser/ui/overlays/index.js +61 -0
- package/dist/browser/ui/renderers/index.js +675 -0
- package/dist/browser/ui/renderers/project-list.markdown.js +499 -0
- package/dist/browser/ui/renderers/project-list.renderer.js +177 -0
- package/dist/dashboard/dashboard.presentation.d.ts +2 -7
- package/dist/dashboard/dashboard.presentation.d.ts.map +1 -1
- package/dist/dashboard/dashboard.presentation.js +51 -53
- package/dist/dashboard/index.d.ts +5 -2
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +53 -3
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +94 -1
- package/dist/docs/saas-boilerplate.docblock.d.ts +2 -1
- package/dist/docs/saas-boilerplate.docblock.d.ts.map +1 -0
- package/dist/docs/saas-boilerplate.docblock.js +45 -51
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +38 -50
- package/dist/handlers/index.d.ts +7 -4
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +358 -4
- package/dist/handlers/saas.handlers.d.ts +60 -59
- package/dist/handlers/saas.handlers.d.ts.map +1 -1
- package/dist/handlers/saas.handlers.js +127 -140
- package/dist/index.d.ts +15 -45
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3335 -75
- package/dist/node/billing/billing.entity.js +113 -0
- package/dist/node/billing/billing.enum.js +19 -0
- package/dist/node/billing/billing.event.js +90 -0
- package/dist/node/billing/billing.handler.js +148 -0
- package/dist/node/billing/billing.operations.js +278 -0
- package/dist/node/billing/billing.presentation.js +52 -0
- package/dist/node/billing/billing.schema.js +121 -0
- package/dist/node/billing/index.js +688 -0
- package/dist/node/dashboard/dashboard.presentation.js +52 -0
- package/dist/node/dashboard/index.js +52 -0
- package/dist/node/docs/index.js +93 -0
- package/dist/node/docs/saas-boilerplate.docblock.js +93 -0
- package/dist/node/example.js +39 -0
- package/dist/node/handlers/index.js +358 -0
- package/dist/node/handlers/saas.handlers.js +134 -0
- package/dist/node/index.js +3340 -0
- package/dist/node/presentations/index.js +290 -0
- package/dist/node/project/index.js +790 -0
- package/dist/node/project/project.entity.js +77 -0
- package/dist/node/project/project.enum.js +18 -0
- package/dist/node/project/project.event.js +103 -0
- package/dist/node/project/project.handler.js +178 -0
- package/dist/node/project/project.operations.js +372 -0
- package/dist/node/project/project.presentation.js +177 -0
- package/dist/node/project/project.schema.js +134 -0
- package/dist/node/saas-boilerplate.feature.js +88 -0
- package/dist/node/seeders/index.js +20 -0
- package/dist/node/settings/index.js +75 -0
- package/dist/node/settings/settings.entity.js +74 -0
- package/dist/node/settings/settings.enum.js +11 -0
- package/dist/node/shared/mock-data.js +104 -0
- package/dist/node/shared/overlay-types.js +0 -0
- package/dist/node/tests/operations.test-spec.js +112 -0
- package/dist/node/ui/SaasDashboard.js +988 -0
- package/dist/node/ui/SaasProjectList.js +162 -0
- package/dist/node/ui/SaasSettingsPanel.js +145 -0
- package/dist/node/ui/hooks/index.js +159 -0
- package/dist/node/ui/hooks/useProjectList.js +66 -0
- package/dist/node/ui/hooks/useProjectMutations.js +91 -0
- package/dist/node/ui/index.js +1808 -0
- package/dist/node/ui/modals/CreateProjectModal.js +153 -0
- package/dist/node/ui/modals/ProjectActionsModal.js +335 -0
- package/dist/node/ui/modals/index.js +487 -0
- package/dist/node/ui/overlays/demo-overlays.js +61 -0
- package/dist/node/ui/overlays/index.js +61 -0
- package/dist/node/ui/renderers/index.js +675 -0
- package/dist/node/ui/renderers/project-list.markdown.js +499 -0
- package/dist/node/ui/renderers/project-list.renderer.js +177 -0
- package/dist/presentations/index.d.ts +13 -14
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +289 -15
- package/dist/project/index.d.ts +11 -8
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/index.js +791 -9
- package/dist/project/project.entity.d.ts +23 -28
- package/dist/project/project.entity.d.ts.map +1 -1
- package/dist/project/project.entity.js +75 -82
- package/dist/project/project.enum.d.ts +2 -7
- package/dist/project/project.enum.d.ts.map +1 -1
- package/dist/project/project.enum.js +16 -23
- package/dist/project/project.event.d.ts +69 -75
- package/dist/project/project.event.d.ts.map +1 -1
- package/dist/project/project.event.js +95 -156
- package/dist/project/project.handler.d.ts +44 -47
- package/dist/project/project.handler.d.ts.map +1 -1
- package/dist/project/project.handler.js +168 -71
- package/dist/project/project.operations.d.ts +341 -347
- package/dist/project/project.operations.d.ts.map +1 -1
- package/dist/project/project.operations.js +366 -253
- package/dist/project/project.presentation.d.ts +2 -7
- package/dist/project/project.presentation.d.ts.map +1 -1
- package/dist/project/project.presentation.js +174 -61
- package/dist/project/project.schema.d.ts +191 -196
- package/dist/project/project.schema.d.ts.map +1 -1
- package/dist/project/project.schema.js +125 -205
- package/dist/saas-boilerplate.feature.d.ts +1 -6
- package/dist/saas-boilerplate.feature.d.ts.map +1 -1
- package/dist/saas-boilerplate.feature.js +87 -206
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +18 -16
- package/dist/settings/index.d.ts +6 -3
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +75 -3
- package/dist/settings/settings.entity.d.ts +23 -28
- package/dist/settings/settings.entity.d.ts.map +1 -1
- package/dist/settings/settings.entity.js +72 -75
- package/dist/settings/settings.enum.d.ts +1 -6
- package/dist/settings/settings.enum.d.ts.map +1 -1
- package/dist/settings/settings.enum.js +10 -19
- package/dist/shared/mock-data.d.ts +74 -77
- package/dist/shared/mock-data.d.ts.map +1 -1
- package/dist/shared/mock-data.js +102 -135
- package/dist/shared/overlay-types.d.ts +25 -28
- package/dist/shared/overlay-types.d.ts.map +1 -1
- package/dist/shared/overlay-types.js +1 -0
- package/dist/tests/operations.test-spec.d.ts +4 -9
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +108 -118
- package/dist/ui/SaasDashboard.d.ts +1 -6
- package/dist/ui/SaasDashboard.d.ts.map +1 -1
- package/dist/ui/SaasDashboard.js +977 -286
- package/dist/ui/SaasProjectList.d.ts +4 -11
- package/dist/ui/SaasProjectList.d.ts.map +1 -1
- package/dist/ui/SaasProjectList.js +159 -72
- package/dist/ui/SaasSettingsPanel.d.ts +1 -6
- package/dist/ui/SaasSettingsPanel.d.ts.map +1 -1
- package/dist/ui/SaasSettingsPanel.js +142 -134
- package/dist/ui/hooks/index.d.ts +3 -3
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +158 -4
- package/dist/ui/hooks/useProjectList.d.ts +26 -30
- package/dist/ui/hooks/useProjectList.d.ts.map +1 -1
- package/dist/ui/hooks/useProjectList.js +63 -71
- package/dist/ui/hooks/useProjectMutations.d.ts +20 -24
- package/dist/ui/hooks/useProjectMutations.d.ts.map +1 -1
- package/dist/ui/hooks/useProjectMutations.js +88 -142
- package/dist/ui/index.d.ts +8 -14
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +1809 -15
- package/dist/ui/modals/CreateProjectModal.d.ts +10 -19
- package/dist/ui/modals/CreateProjectModal.d.ts.map +1 -1
- package/dist/ui/modals/CreateProjectModal.js +150 -135
- package/dist/ui/modals/ProjectActionsModal.d.ts +20 -33
- package/dist/ui/modals/ProjectActionsModal.d.ts.map +1 -1
- package/dist/ui/modals/ProjectActionsModal.js +333 -289
- package/dist/ui/modals/index.d.ts +3 -3
- package/dist/ui/modals/index.d.ts.map +1 -0
- package/dist/ui/modals/index.js +487 -3
- package/dist/ui/overlays/demo-overlays.d.ts +10 -8
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
- package/dist/ui/overlays/demo-overlays.js +60 -68
- package/dist/ui/overlays/index.d.ts +2 -2
- package/dist/ui/overlays/index.d.ts.map +1 -0
- package/dist/ui/overlays/index.js +62 -3
- package/dist/ui/renderers/index.d.ts +3 -3
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +675 -3
- package/dist/ui/renderers/project-list.markdown.d.ts +15 -14
- package/dist/ui/renderers/project-list.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/project-list.markdown.js +496 -146
- package/dist/ui/renderers/project-list.renderer.d.ts +6 -7
- package/dist/ui/renderers/project-list.renderer.d.ts.map +1 -1
- package/dist/ui/renderers/project-list.renderer.js +176 -15
- package/package.json +508 -98
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -180
- package/dist/billing/billing.entity.js.map +0 -1
- package/dist/billing/billing.enum.js.map +0 -1
- package/dist/billing/billing.event.js.map +0 -1
- package/dist/billing/billing.handler.js.map +0 -1
- package/dist/billing/billing.operations.js.map +0 -1
- package/dist/billing/billing.presentation.js.map +0 -1
- package/dist/billing/billing.schema.js.map +0 -1
- package/dist/dashboard/dashboard.presentation.js.map +0 -1
- package/dist/docs/saas-boilerplate.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/saas.handlers.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/project/project.entity.js.map +0 -1
- package/dist/project/project.enum.js.map +0 -1
- package/dist/project/project.event.js.map +0 -1
- package/dist/project/project.handler.js.map +0 -1
- package/dist/project/project.operations.js.map +0 -1
- package/dist/project/project.presentation.js.map +0 -1
- package/dist/project/project.schema.js.map +0 -1
- package/dist/saas-boilerplate.feature.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/settings/settings.entity.js.map +0 -1
- package/dist/settings/settings.enum.js.map +0 -1
- package/dist/shared/mock-data.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/SaasDashboard.js.map +0 -1
- package/dist/ui/SaasProjectList.js.map +0 -1
- package/dist/ui/SaasSettingsPanel.js.map +0 -1
- package/dist/ui/hooks/useProjectList.js.map +0 -1
- package/dist/ui/hooks/useProjectMutations.js.map +0 -1
- package/dist/ui/modals/CreateProjectModal.js.map +0 -1
- package/dist/ui/modals/ProjectActionsModal.js.map +0 -1
- package/dist/ui/overlays/demo-overlays.js.map +0 -1
- package/dist/ui/renderers/project-list.markdown.js.map +0 -1
- package/dist/ui/renderers/project-list.renderer.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// src/project/project.entity.ts
|
|
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
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/project/project.enum.ts
|
|
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
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/project/project.event.ts
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
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
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// src/shared/mock-data.ts
|
|
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
|
+
};
|