@critical-path/svelte 0.17.11 → 0.18.1
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/README.md +13 -0
- package/dist/activity-state.svelte.d.ts +3 -0
- package/dist/activity-state.svelte.d.ts.map +1 -1
- package/dist/attachment-state.svelte.d.ts +3 -0
- package/dist/attachment-state.svelte.d.ts.map +1 -1
- package/dist/comment-state.svelte.d.ts +3 -0
- package/dist/comment-state.svelte.d.ts.map +1 -1
- package/dist/critical-path-state.svelte.d.ts +3 -0
- package/dist/critical-path-state.svelte.d.ts.map +1 -1
- package/dist/deliverable-state.svelte.d.ts +3 -0
- package/dist/deliverable-state.svelte.d.ts.map +1 -1
- package/dist/deliverable-summary-state.svelte.d.ts +3 -0
- package/dist/deliverable-summary-state.svelte.d.ts.map +1 -1
- package/dist/index.js +645 -551
- package/dist/latest-request.d.ts +15 -0
- package/dist/latest-request.d.ts.map +1 -0
- package/dist/project-state.svelte.d.ts +3 -0
- package/dist/project-state.svelte.d.ts.map +1 -1
- package/dist/task-metrics-state.svelte.d.ts +3 -0
- package/dist/task-metrics-state.svelte.d.ts.map +1 -1
- package/dist/task-state.svelte.d.ts +3 -0
- package/dist/task-state.svelte.d.ts.map +1 -1
- package/dist/task-transitions-state.svelte.d.ts +3 -0
- package/dist/task-transitions-state.svelte.d.ts.map +1 -1
- package/dist/timeline-ladder-state.svelte.d.ts +3 -0
- package/dist/timeline-ladder-state.svelte.d.ts.map +1 -1
- package/dist/workflow-state.svelte.d.ts +3 -0
- package/dist/workflow-state.svelte.d.ts.map +1 -1
- package/dist/workload-state.svelte.d.ts +3 -0
- package/dist/workload-state.svelte.d.ts.map +1 -1
- package/package.json +10 -6
- package/CHANGELOG.md +0 -714
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/src/activity-state.svelte.ts +0 -193
- package/src/attachment-state.svelte.ts +0 -61
- package/src/comment-state.svelte.ts +0 -130
- package/src/critical-path-state.svelte.ts +0 -33
- package/src/deliverable-state.svelte.ts +0 -77
- package/src/deliverable-summary-state.svelte.ts +0 -41
- package/src/index.test.ts +0 -885
- package/src/index.ts +0 -23
- package/src/kanban-state.svelte.ts +0 -113
- package/src/project-state.svelte.ts +0 -54
- package/src/task-metrics-state.svelte.ts +0 -83
- package/src/task-state.svelte.ts +0 -195
- package/src/task-transitions-state.svelte.ts +0 -36
- package/src/timeline-ladder-state.svelte.ts +0 -58
- package/src/webmcp-state.svelte.ts +0 -78
- package/src/workflow-state.svelte.ts +0 -62
- package/src/workload-state.svelte.ts +0 -83
- package/tsconfig.json +0 -8
- package/vite.config.ts +0 -22
- package/vitest.config.ts +0 -6
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { CriticalPathClient } from '@critical-path/client';
|
|
3
|
-
import type { Workflow } from '@critical-path/core';
|
|
4
|
-
|
|
5
|
-
export class WorkflowState {
|
|
6
|
-
data = $state<Workflow[]>([]);
|
|
7
|
-
loading = $state<boolean>(false);
|
|
8
|
-
error = $state<Error | null>(null);
|
|
9
|
-
|
|
10
|
-
constructor(private client: CriticalPathClient) {}
|
|
11
|
-
|
|
12
|
-
async fetch() {
|
|
13
|
-
this.loading = true;
|
|
14
|
-
this.error = null;
|
|
15
|
-
try {
|
|
16
|
-
this.data = await this.client.getWorkflows();
|
|
17
|
-
} catch (err) {
|
|
18
|
-
this.error = err instanceof Error ? err : new Error(String(err));
|
|
19
|
-
} finally {
|
|
20
|
-
this.loading = false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async createWorkflow(input: Omit<Workflow, 'id' | 'createdAt' | 'updatedAt'>) {
|
|
25
|
-
try {
|
|
26
|
-
const created = await this.client.createWorkflow(input);
|
|
27
|
-
this.data = [...this.data, created];
|
|
28
|
-
return created;
|
|
29
|
-
} catch (err) {
|
|
30
|
-
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
31
|
-
this.error = errorObj;
|
|
32
|
-
throw errorObj;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async updateWorkflow(id: string, updates: Partial<Workflow>) {
|
|
37
|
-
try {
|
|
38
|
-
const updated = await this.client.updateWorkflow(id, updates);
|
|
39
|
-
this.data = this.data.map((w) => (w.id === id ? updated : w));
|
|
40
|
-
return updated;
|
|
41
|
-
} catch (err) {
|
|
42
|
-
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
43
|
-
this.error = errorObj;
|
|
44
|
-
throw errorObj;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async deleteWorkflow(id: string) {
|
|
49
|
-
try {
|
|
50
|
-
await this.client.deleteWorkflow(id);
|
|
51
|
-
this.data = this.data.filter((w) => w.id !== id);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
54
|
-
this.error = errorObj;
|
|
55
|
-
throw errorObj;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function createWorkflowState(client: CriticalPathClient): WorkflowState {
|
|
61
|
-
return new WorkflowState(client);
|
|
62
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { CriticalPathClient } from '@critical-path/client';
|
|
3
|
-
import type {
|
|
4
|
-
WorkloadDistribution,
|
|
5
|
-
WorkloadDistributionOptions,
|
|
6
|
-
WorkloadInterval,
|
|
7
|
-
WorkloadGroupBy,
|
|
8
|
-
WorkloadMetric,
|
|
9
|
-
WorkloadBucket
|
|
10
|
-
} from '@critical-path/core';
|
|
11
|
-
|
|
12
|
-
export class WorkloadState {
|
|
13
|
-
data = $state<WorkloadDistribution | null>(null);
|
|
14
|
-
interval = $state<WorkloadInterval>('week');
|
|
15
|
-
groupBy = $state<WorkloadGroupBy>('assignee');
|
|
16
|
-
metric = $state<WorkloadMetric>('blended');
|
|
17
|
-
loading = $state<boolean>(false);
|
|
18
|
-
error = $state<Error | null>(null);
|
|
19
|
-
|
|
20
|
-
buckets = $derived<WorkloadBucket[]>(this.data?.buckets ?? []);
|
|
21
|
-
seriesKeys = $derived<string[]>(this.data?.seriesKeys ?? []);
|
|
22
|
-
seriesLabels = $derived<Record<string, string>>(this.data?.seriesLabels ?? {});
|
|
23
|
-
totalHours = $derived<number>(this.data?.totalHours ?? 0);
|
|
24
|
-
totalCapacity = $derived<number>(this.data?.totalCapacity ?? 0);
|
|
25
|
-
averageUtilization = $derived<number | undefined>(this.data?.averageUtilization);
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
private client: CriticalPathClient,
|
|
29
|
-
public projectId?: string,
|
|
30
|
-
public initialOptions?: WorkloadDistributionOptions
|
|
31
|
-
) {
|
|
32
|
-
if (initialOptions?.interval) {
|
|
33
|
-
this.interval = initialOptions.interval;
|
|
34
|
-
}
|
|
35
|
-
if (initialOptions?.groupBy) {
|
|
36
|
-
this.groupBy = initialOptions.groupBy;
|
|
37
|
-
}
|
|
38
|
-
if (initialOptions?.metric) {
|
|
39
|
-
this.metric = initialOptions.metric;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async setInterval(newInterval: WorkloadInterval) {
|
|
44
|
-
this.interval = newInterval;
|
|
45
|
-
await this.fetch();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async setGroupBy(newGroupBy: WorkloadGroupBy) {
|
|
49
|
-
this.groupBy = newGroupBy;
|
|
50
|
-
await this.fetch();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async setMetric(newMetric: WorkloadMetric) {
|
|
54
|
-
this.metric = newMetric;
|
|
55
|
-
await this.fetch();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async fetch(options?: WorkloadDistributionOptions) {
|
|
59
|
-
this.loading = true;
|
|
60
|
-
this.error = null;
|
|
61
|
-
try {
|
|
62
|
-
this.data = await this.client.getWorkloadDistribution(this.projectId, {
|
|
63
|
-
...this.initialOptions,
|
|
64
|
-
interval: this.interval,
|
|
65
|
-
groupBy: this.groupBy,
|
|
66
|
-
metric: this.metric,
|
|
67
|
-
...options
|
|
68
|
-
});
|
|
69
|
-
} catch (err) {
|
|
70
|
-
this.error = err instanceof Error ? err : new Error(String(err));
|
|
71
|
-
} finally {
|
|
72
|
-
this.loading = false;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function createWorkloadState(
|
|
78
|
-
client: CriticalPathClient,
|
|
79
|
-
projectId?: string,
|
|
80
|
-
initialOptions?: WorkloadDistributionOptions
|
|
81
|
-
): WorkloadState {
|
|
82
|
-
return new WorkloadState(client, projectId, initialOptions);
|
|
83
|
-
}
|
package/tsconfig.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [svelte()],
|
|
7
|
-
build: {
|
|
8
|
-
lib: {
|
|
9
|
-
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
10
|
-
formats: ['es'],
|
|
11
|
-
fileName: () => 'index.js'
|
|
12
|
-
},
|
|
13
|
-
rollupOptions: {
|
|
14
|
-
external: [
|
|
15
|
-
'@critical-path/client',
|
|
16
|
-
'@critical-path/core',
|
|
17
|
-
'svelte',
|
|
18
|
-
/^svelte\//
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|