Skip to content

Commit

Permalink
Fixed shared folder references (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhaufe authored Nov 20, 2024
1 parent 05aad6b commit 5b7142e
Show file tree
Hide file tree
Showing 59 changed files with 101 additions and 83 deletions.
3 changes: 1 addition & 2 deletions application/OrganizationInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { AppUserOrganizationRole, AppRole, AppUser, AuditLog } from "~/domain/ap
import { Belongs } from "~/domain/relations/Belongs.js";
import { validate } from 'uuid'
import { Follows } from "~/domain/relations";
import groupBy from "~/shared/groupBy";
import type NaturalLanguageToRequirementService from "~/server/data/services/NaturalLanguageToRequirementService";
import slugify from "~/shared/slugify";
import { groupBy, slugify } from "#shared/utils";

type OrganizationInteractorConstructor = {
entityManager: EntityManager,
Expand Down
2 changes: 1 addition & 1 deletion components/TopNavigation.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import deSlugify from '~/shared/deSlugify.js';
import { deSlugify } from '#shared/utils';
const { data, signIn, signOut } = useAuth(),
router = useRouter()
Expand Down
4 changes: 2 additions & 2 deletions components/XDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import type Dialog from 'primevue/dialog'
import type DataTable from 'primevue/datatable'
import { FilterMatchMode } from 'primevue/api';
import camelCaseToTitle from '~/shared/camelCaseToTitle.js';
import type { AuditLogViewModel } from '~/shared/models';
import type { AuditLogViewModel } from '#shared/models';
import { camelCaseToTitle } from '#shared/utils';
export type RequirementFieldType = { type: 'requirement', options: { id: string, name: string }[] }
Expand Down
2 changes: 1 addition & 1 deletion domain/requirements/Organization.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Entity, Property } from "@mikro-orm/core";
import slugify from "../../shared/slugify.js";
import { slugify } from "../../shared/utils/slugify.js";
import { Requirement } from "./Requirement.js";
import { type Properties } from "../types/index.js";
import { ReqType } from "./ReqType.js";
Expand Down
2 changes: 1 addition & 1 deletion domain/requirements/Solution.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Entity, Property } from '@mikro-orm/core';
import { type Properties } from '../types/index.js';
import slugify from '../../shared/slugify.js';
import { slugify } from '../../shared/utils/slugify.js';
import { Requirement } from './Requirement.js';
import { ReqType } from './ReqType.js';

Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-11-05',
compatibilityDate: '2024-11-19',
devtools: {
enabled: process.env.NODE_ENV === 'development'
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@final-hill/cathedral",
"version": "0.19.0",
"version": "0.19.1",
"description": "Requirements management system",
"keywords": [],
"private": true,
Expand Down Expand Up @@ -77,4 +77,4 @@
"vitest": "^2.1.4",
"vue-tsc": "^2.1.10"
}
}
}
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { OrganizationViewModel } from '~/shared/models'
import type { OrganizationViewModel } from '#shared/models'
definePageMeta({ name: 'Home' })
Expand Down
2 changes: 1 addition & 1 deletion pages/new-organization.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import slugify from '~/shared/slugify.js';
import { slugify } from '#shared/utils';
useHead({ title: 'New Organization' })
definePageMeta({ name: 'New Organization' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import slugify from '~/shared/slugify.js';
import type { SolutionViewModel } from '~/shared/models'
import type { SolutionViewModel } from '#shared/models'
import { slugify } from '#shared/utils';
useHead({ title: 'Edit Solution' })
definePageMeta({ name: 'Edit Solution' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { useFetch } from 'nuxt/app';
import type { AssumptionViewModel, SolutionViewModel } from '~/shared/models';
import type { AssumptionViewModel, SolutionViewModel } from '#shared/models';
useHead({ title: 'Assumptions' })
definePageMeta({ name: 'Assumptions' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { useHead, useRoute, useNuxtApp, useFetch } from '#imports';
import type { EnvironmentComponentViewModel, SolutionViewModel } from '~/shared/models';
import type { EnvironmentComponentViewModel, SolutionViewModel } from '#shared/models';
useHead({ title: 'Components' })
definePageMeta({ name: 'Environment Components' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { useFetch } from 'nuxt/app';
import type { ConstraintViewModel, SolutionViewModel } from '~/shared/models'
import type { ConstraintViewModel, SolutionViewModel } from '#shared/models'
import { ConstraintCategory } from '~/domain/requirements/ConstraintCategory';
useHead({ title: 'Constraints' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { EffectViewModel, SolutionViewModel } from '~/shared/models'
import type { EffectViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Effects' })
definePageMeta({ name: 'Effects' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { GlossaryTermViewModel, SolutionViewModel } from '~/shared/models'
import type { GlossaryTermViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Glossary' })
definePageMeta({ name: 'Glossary' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { InvariantViewModel, SolutionViewModel } from '~/shared/models'
import type { InvariantViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Invariants' })
definePageMeta({ name: 'Invariants' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import debounce from '~/shared/debounce';
import type { OutcomeViewModel, SolutionViewModel } from '~/shared/models';
import type { OutcomeViewModel, SolutionViewModel } from '#shared/models';
import { debounce } from '~/shared/utils';
useHead({ title: 'Context and Objective' })
definePageMeta({ name: 'Context and Objective' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { MoscowPriority } from '~/domain/requirements/MoscowPriority.js';
import type { FunctionalBehaviorViewModel, SolutionViewModel } from '~/shared/models';
import type { FunctionalBehaviorViewModel, SolutionViewModel } from '#shared/models';
useHead({ title: 'Functionality' })
definePageMeta({ name: 'Goals Functionality' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { LimitViewModel, SolutionViewModel } from '~/shared/models'
import type { LimitViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Limitations' })
definePageMeta({ name: 'Limitations' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { OutcomeViewModel, SolutionViewModel } from '~/shared/models'
import type { OutcomeViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Outcomes' })
definePageMeta({ name: 'Outcomes' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { MoscowPriority } from '~/domain/requirements/MoscowPriority.js'
import type { EpicViewModel, StakeholderViewModel, FunctionalBehaviorViewModel, OutcomeViewModel, SolutionViewModel } from '~/shared/models'
import type { EpicViewModel, StakeholderViewModel, FunctionalBehaviorViewModel, OutcomeViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Scenarios' })
definePageMeta({ name: 'Goal Scenarios' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import debounce from '~/shared/debounce';
import type { ObstacleViewModel, SolutionViewModel } from '~/shared/models';
import type { ObstacleViewModel, SolutionViewModel } from '#shared/models';
import { debounce } from '#shared/utils';
useHead({ title: 'Situation' })
definePageMeta({ name: 'Situation' })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import mermaid from 'mermaid';
import { StakeholderCategory } from '~/domain/requirements/StakeholderCategory.js';
import { StakeholderSegmentation } from '~/domain/requirements/StakeholderSegmentation.js';
import type { StakeholderViewModel, SolutionViewModel } from '~/shared/models';
import type { StakeholderViewModel, SolutionViewModel } from '#shared/models';
useHead({ title: 'Stakeholders' })
definePageMeta({ name: 'Stakeholders' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { SolutionViewModel } from '~/shared/models'
import type { SolutionViewModel } from '#shared/models'
useHead({ title: 'Solution' })
definePageMeta({ name: 'Solution' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { PersonViewModel, SolutionViewModel } from '~/shared/models'
import type { PersonViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Roles & Personnel' })
definePageMeta({ name: 'Roles & Personnel' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { SystemComponentViewModel, SolutionViewModel } from '~/shared/models';
import type { SystemComponentViewModel, SolutionViewModel } from '#shared/models';
useHead({ title: 'Components' })
definePageMeta({ name: 'System Components' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { FunctionalBehaviorViewModel, NonFunctionalBehaviorViewModel, SystemComponentViewModel, SolutionViewModel } from '~/shared/models';
import type { FunctionalBehaviorViewModel, NonFunctionalBehaviorViewModel, SystemComponentViewModel, SolutionViewModel } from '#shared/models';
useHead({ title: 'Functionality' })
definePageMeta({ name: 'Functionality' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { MoscowPriority } from '~/domain/requirements/MoscowPriority.js';
import type { AssumptionViewModel, EffectViewModel, FunctionalBehaviorViewModel, OutcomeViewModel, StakeholderViewModel, SolutionViewModel, UseCaseViewModel, UserStoryViewModel } from '~/shared/models';
import type { AssumptionViewModel, EffectViewModel, FunctionalBehaviorViewModel, OutcomeViewModel, StakeholderViewModel, SolutionViewModel, UseCaseViewModel, UserStoryViewModel } from '#shared/models';
useHead({ title: 'Scenarios' })
definePageMeta({ name: 'Scenarios' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<script lang="ts" setup>
import snakeCaseToTitle from '~/shared/snakeCaseToTitle.js';
import camelCaseToTitle from '~/shared/camelCaseToTitle.js';
import snakeCaseToSlug from '~/shared/snakeCaseToSlug.js';
import type { DataTableRowExpandEvent, DataTableRowCollapseEvent, DataTableExpandedRows } from 'primevue/datatable';
import type { ParsedRequirementViewModel, RequirementViewModel, SolutionViewModel } from '~/shared/models';
import type { ParsedRequirementViewModel, RequirementViewModel, SolutionViewModel } from '#shared/models';
import type { ReqType } from '~/domain/requirements/ReqType';
import { camelCaseToTitle, snakeCaseToSlug, snakeCaseToTitle } from '~/shared/utils';
useHead({ title: 'Workbox' });
definePageMeta({ name: 'Workbox' });
Expand Down
4 changes: 2 additions & 2 deletions pages/o/[organization-slug]/edit-entry.client.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import slugify from '~/shared/slugify.js';
import type { OrganizationViewModel } from '~/shared/models';
import type { OrganizationViewModel } from '#shared/models';
import { slugify } from '#shared/utils';
useHead({ title: 'Edit Organization' })
definePageMeta({ name: 'Edit Organization' })
Expand Down
2 changes: 1 addition & 1 deletion pages/o/[organization-slug]/index.client.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { OrganizationViewModel, SolutionViewModel } from '~/shared/models'
import type { OrganizationViewModel, SolutionViewModel } from '#shared/models'
useHead({ title: 'Organization' })
definePageMeta({ name: 'Organization' })
Expand Down
4 changes: 2 additions & 2 deletions pages/o/[organization-slug]/new-solution.client.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import slugify from '~/shared/slugify.js';
import type { OrganizationViewModel } from '~/shared/models'
import type { OrganizationViewModel } from '#shared/models'
import { slugify } from '#shared/utils';
useHead({ title: 'New Solution' })
definePageMeta({ name: 'New Solution' })
Expand Down
2 changes: 1 addition & 1 deletion pages/o/[organization-slug]/users.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { AppRole } from '~/domain/application/AppRole'
import type { AppUserViewModel, OrganizationViewModel } from '~/shared/models'
import type { AppUserViewModel, OrganizationViewModel } from '#shared/models'
useHead({ title: 'Users' })
definePageMeta({ name: 'Organization Users' })
Expand Down
2 changes: 1 addition & 1 deletion server/data/llm-zod-schemas/FunctionalBehaviorSchema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod";
import dedent from "~/shared/dedent";
import { dedent } from "#shared/utils";

export default z.object({
type: z.literal('FunctionalBehavior'),
Expand Down
2 changes: 1 addition & 1 deletion server/data/llm-zod-schemas/NonFunctionalBehaviorSchema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod";
import dedent from "~/shared/dedent";
import { dedent } from "#shared/utils";

export default z.object({
type: z.literal('NonFunctionalBehavior'),
Expand Down
2 changes: 1 addition & 1 deletion server/data/llm-zod-schemas/UseCaseSchema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod";
import dedent from "~/shared/dedent";
import { dedent } from "#shared/utils";

export default z.object({
type: z.literal('UseCase'),
Expand Down
2 changes: 1 addition & 1 deletion server/data/llm-zod-schemas/UserStorySchema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod";
import dedent from "~/shared/dedent";
import { dedent } from "#shared/utils";

export default z.object({
type: z.literal('UserStory'),
Expand Down
3 changes: 1 addition & 2 deletions server/data/services/NaturalLanguageToRequirementService.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { AzureOpenAI } from "openai";
import groupBy from "~/shared/groupBy";
import dedent from '~/shared/dedent.js'
import { v7 as uuidv7 } from 'uuid';
import zodToJsonSchema from "zod-to-json-schema";
import zodSchema from '../llm-zod-schemas/index.js'
import { zodResponseFormat } from "openai/helpers/zod";
import { dedent, groupBy } from "#shared/utils";

type LLMResponseType = typeof zodSchema['_type']['requirements']
type ArrayToUnion<T> = T extends (infer U)[] ? U : never
Expand Down
7 changes: 0 additions & 7 deletions shared/deSlugify.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import camelCaseToSlug from './camelCaseToSlug';
import { camelCaseToSlug } from './camelCaseToSlug';

describe('camelCaseToSlug', () => {
it('should convert single camelCase word to slug', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* @example
* camelCaseToSlug('camelCase') // 'camel-case'
*/
export default (input: string): string =>
const camelCaseToSlug = (input: string): string =>
input.trim() // Remove leading and trailing whitespace
.replace(/[^a-zA-Z0-9]+/g, '-') // Replace non-alphanumeric characters with hyphens
.replace(/([a-z][^A-Z]*?)([A-Z])/g, '$1-$2') // Insert hyphen between lowercase and uppercase letters
.replace(/([A-Z])([A-Z][^A-Z]*?)/g, '$1-$2') // Insert hyphen between two uppercase letters
.replace(/-+/g, '-') // replace multiple hyphens with a single hyphen
.toLowerCase(); // Convert the entire string to lowercase

export { camelCaseToSlug }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import camelCaseToTitle from './camelCaseToTitle';
import { camelCaseToTitle } from './camelCaseToTitle';

describe('camelCaseToTitle', () => {
it('should convert camelCase to Title Case', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* @example
* camelCaseToTitle('camelCaseString'); // 'Camel Case String'
*/
export default (str: string) =>
const camelCaseToTitle = (str: string) =>
str.trim() // Remove leading and trailing whitespace
.replace(/([A-Z])/g, ' $1') // Add space before uppercase letters
.replace(/^./, str => str.toUpperCase()) // Capitalize the first letter
.replace(/^./, str => str.toUpperCase()) // Capitalize the first letter

export { camelCaseToTitle }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import deSlugify from './deSlugify';
import { deSlugify } from './deSlugify';

describe('deSlugify', () => {
it('should replace hyphens with spaces', () => {
Expand Down
4 changes: 4 additions & 0 deletions shared/utils/deSlugify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const deSlugify = (str: string) => str.replace(/-/g, ' ')
.replace(/\b\w/g, char => char.toUpperCase());

export { deSlugify }
Loading

0 comments on commit 5b7142e

Please sign in to comment.