@osdk/create-app 0.15.0 → 0.16.0-main-20240520213923
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/CHANGELOG.md +6 -0
- package/bin/createOsdkApp.mjs +1 -1
- package/build/{js/index.browser.mjs → browser/index.js} +2 -2
- package/build/browser/index.js.map +1 -0
- package/build/{js → cjs}/index.cjs +1 -1
- package/build/cjs/index.cjs.map +1 -0
- package/build/{js/index.mjs → esm/index.js} +2 -2
- package/build/esm/index.js.map +1 -0
- package/package.json +12 -12
- package/templates/template-next-static-export/package.json.hbs +1 -1
- package/templates/template-react/package.json.hbs +6 -6
- package/templates/template-tutorial-todo-app/package.json.hbs +6 -6
- package/templates/template-tutorial-todo-app/src/{CreateTaskButton.tsx.hbs → CreateTaskButton.tsx} +2 -2
- package/templates/template-tutorial-todo-app/src/{CreateTaskDialog.tsx.hbs → CreateTaskDialog.tsx} +2 -2
- package/templates/template-tutorial-todo-app/src/{DeleteProjectButton.tsx.hbs → DeleteProjectButton.tsx} +2 -2
- package/templates/template-tutorial-todo-app/src/{DeleteProjectDialog.tsx.hbs → DeleteProjectDialog.tsx} +2 -2
- package/templates/template-tutorial-todo-app/src/{Home.tsx.hbs → Home.tsx} +2 -2
- package/templates/template-tutorial-todo-app/src/{ProjectSelect.tsx.hbs → ProjectSelect.tsx} +4 -4
- package/templates/template-tutorial-todo-app/src/{TaskList.tsx.hbs → TaskList.tsx} +2 -2
- package/templates/template-tutorial-todo-app/src/{TaskListItem.tsx.hbs → TaskListItem.tsx} +3 -3
- package/templates/template-tutorial-todo-app/src/mocks.ts +137 -0
- package/templates/template-tutorial-todo-app/src/{useProjectTasks.ts.hbs → useProjectTasks.ts} +13 -17
- package/templates/template-tutorial-todo-app/src/{useProjects.ts.hbs → useProjects.ts} +6 -7
- package/templates/template-vue/package.json.hbs +1 -1
- package/build/js/index.browser.mjs.map +0 -1
- package/build/js/index.cjs.map +0 -1
- package/build/js/index.mjs.map +0 -1
- package/templates/template-tutorial-todo-app/src/mocks.ts.hbs +0 -208
- /package/build/{types → esm}/cli.d.ts +0 -0
- /package/build/{types → esm}/cli.d.ts.map +0 -0
- /package/build/{types → esm}/cli.test.d.ts +0 -0
- /package/build/{types → esm}/cli.test.d.ts.map +0 -0
- /package/build/{types → esm}/consola.d.ts +0 -0
- /package/build/{types → esm}/consola.d.ts.map +0 -0
- /package/build/{types → esm}/generate/generateEnv.d.ts +0 -0
- /package/build/{types → esm}/generate/generateEnv.d.ts.map +0 -0
- /package/build/{types → esm}/generate/generateEnv.test.d.ts +0 -0
- /package/build/{types → esm}/generate/generateEnv.test.d.ts.map +0 -0
- /package/build/{types → esm}/generate/generateFoundryConfigJson.d.ts +0 -0
- /package/build/{types → esm}/generate/generateFoundryConfigJson.d.ts.map +0 -0
- /package/build/{types → esm}/generate/generateFoundryConfigJson.test.d.ts +0 -0
- /package/build/{types → esm}/generate/generateFoundryConfigJson.test.d.ts.map +0 -0
- /package/build/{types → esm}/generate/generateNpmRc.d.ts +0 -0
- /package/build/{types → esm}/generate/generateNpmRc.d.ts.map +0 -0
- /package/build/{types → esm}/generate/generateNpmRc.test.d.ts +0 -0
- /package/build/{types → esm}/generate/generateNpmRc.test.d.ts.map +0 -0
- /package/build/{types → esm}/highlight.d.ts +0 -0
- /package/build/{types → esm}/highlight.d.ts.map +0 -0
- /package/build/{types → esm}/index.d.ts +0 -0
- /package/build/{types → esm}/index.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptApplicationRid.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptApplicationRid.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptApplicationRid.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptApplicationRid.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptApplicationUrl.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptApplicationUrl.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptApplicationUrl.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptApplicationUrl.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptClientId.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptClientId.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptClientId.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptClientId.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptCorsProxy.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptCorsProxy.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptCorsProxy.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptCorsProxy.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptFoundryUrl.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptFoundryUrl.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptFoundryUrl.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptFoundryUrl.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptOsdkPackage.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptOsdkPackage.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptOsdkPackage.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptOsdkPackage.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptOverwrite.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptOverwrite.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptOverwrite.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptOverwrite.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptProject.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptProject.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptProject.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptProject.test.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptTemplate.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptTemplate.d.ts.map +0 -0
- /package/build/{types → esm}/prompts/promptTemplate.test.d.ts +0 -0
- /package/build/{types → esm}/prompts/promptTemplate.test.d.ts.map +0 -0
- /package/build/{types → esm}/run.d.ts +0 -0
- /package/build/{types → esm}/run.d.ts.map +0 -0
- /package/build/{types → esm}/templates.d.ts +0 -0
- /package/build/{types → esm}/templates.d.ts.map +0 -0
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { OsdkTodoProject, OsdkTodoTask } from "{{osdkPackage}}/ontology/objects";
|
|
2
|
-
import { LocalDate } from "{{osdkPackage}}";
|
|
3
|
-
|
|
4
|
-
interface MockProject {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
tasks: MockTask[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface MockTask {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const projects: MockProject[] = [
|
|
16
|
-
{
|
|
17
|
-
id: "1",
|
|
18
|
-
name: "Fake Project",
|
|
19
|
-
tasks: [
|
|
20
|
-
{
|
|
21
|
-
id: "1",
|
|
22
|
-
name: "Try to",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "2",
|
|
26
|
-
name: "Implement this",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "3",
|
|
30
|
-
name: "With the Ontology SDK!",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: "2",
|
|
36
|
-
name: "Yet Another Fake Project",
|
|
37
|
-
tasks: [
|
|
38
|
-
{
|
|
39
|
-
id: "4",
|
|
40
|
-
name: "More tasks here",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
async function delay(): Promise<void> {
|
|
47
|
-
return new Promise((resolve) =>
|
|
48
|
-
setTimeout(() => resolve(), 500 + Math.random() * 1000)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Good enough random id for mocks
|
|
53
|
-
function randomId(): string {
|
|
54
|
-
return `${Math.floor(Math.random() * 2 ** 31)}`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function getProjects(): Promise<OsdkTodoProject[]> {
|
|
58
|
-
await delay();
|
|
59
|
-
const result = [...projects];
|
|
60
|
-
result.sort((p1, p2) => p1.name.localeCompare(p2.name));
|
|
61
|
-
return result.map(project);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function createProject({
|
|
65
|
-
name,
|
|
66
|
-
}: {
|
|
67
|
-
name: string;
|
|
68
|
-
}): Promise<OsdkTodoProject["__primaryKey"]> {
|
|
69
|
-
await delay();
|
|
70
|
-
const id = randomId();
|
|
71
|
-
projects.push({ id, name, tasks: [] });
|
|
72
|
-
return id;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function deleteProject(id: string): Promise<void> {
|
|
76
|
-
await delay();
|
|
77
|
-
const idx = projects.findIndex((p) => p.id === id);
|
|
78
|
-
if (idx !== -1) {
|
|
79
|
-
projects.splice(idx, 1);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async function createTask({
|
|
84
|
-
name,
|
|
85
|
-
projectId,
|
|
86
|
-
}: {
|
|
87
|
-
name: string;
|
|
88
|
-
projectId: string;
|
|
89
|
-
}): Promise<OsdkTodoTask["__primaryKey"]> {
|
|
90
|
-
await delay();
|
|
91
|
-
const project = projects.find((p) => p.id === projectId);
|
|
92
|
-
if (project == null) {
|
|
93
|
-
throw new Error(`Project ${projectId} not found!`);
|
|
94
|
-
}
|
|
95
|
-
const id = randomId();
|
|
96
|
-
project.tasks.unshift({ id, name });
|
|
97
|
-
return id;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async function deleteTask(id: string): Promise<void> {
|
|
101
|
-
await delay();
|
|
102
|
-
for (const project of projects) {
|
|
103
|
-
const idx = project.tasks.findIndex((t) => t.id === id);
|
|
104
|
-
if (idx !== -1) {
|
|
105
|
-
project.tasks.splice(idx, 1);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function project(mockProject: MockProject): OsdkTodoProject {
|
|
111
|
-
return {
|
|
112
|
-
__apiName: "OsdkTodoProject",
|
|
113
|
-
__primaryKey: mockProject.id,
|
|
114
|
-
__rid: `${mockProject.id}`,
|
|
115
|
-
$apiName: "OsdkTodoProject",
|
|
116
|
-
$primaryKey: mockProject.id,
|
|
117
|
-
$rid: `${mockProject.id}`,
|
|
118
|
-
id: mockProject.id,
|
|
119
|
-
name: mockProject.name,
|
|
120
|
-
osdkTodoTasks: {
|
|
121
|
-
all: async () => ({
|
|
122
|
-
type: "ok",
|
|
123
|
-
value: mockProject.tasks.map((mockTask) => task(mockProject, mockTask)),
|
|
124
|
-
}),
|
|
125
|
-
get: async () => ({
|
|
126
|
-
type: "error",
|
|
127
|
-
error: {
|
|
128
|
-
errorType: "UNKNOWN",
|
|
129
|
-
errorName: "UnknownError",
|
|
130
|
-
originalError: "",
|
|
131
|
-
name: "Error",
|
|
132
|
-
message: "Not implemented!",
|
|
133
|
-
},
|
|
134
|
-
}),
|
|
135
|
-
page: async () => ({
|
|
136
|
-
type: "error",
|
|
137
|
-
error: {
|
|
138
|
-
errorType: "UNKNOWN",
|
|
139
|
-
errorName: "UnknownError",
|
|
140
|
-
originalError: "",
|
|
141
|
-
name: "Error",
|
|
142
|
-
message: "Not implemented!",
|
|
143
|
-
},
|
|
144
|
-
}),
|
|
145
|
-
asyncIter: () => {
|
|
146
|
-
throw new Error("Function not implemented.");
|
|
147
|
-
},
|
|
148
|
-
fetchPage: () => {
|
|
149
|
-
throw new Error("Function not implemented.");
|
|
150
|
-
},
|
|
151
|
-
fetchPageWithErrors: () => {
|
|
152
|
-
throw new Error("Function not implemented.");
|
|
153
|
-
},
|
|
154
|
-
fetchOneWithErrors: () => {
|
|
155
|
-
throw new Error("Function not implemented.");
|
|
156
|
-
},
|
|
157
|
-
fetchOne: () => {
|
|
158
|
-
throw new Error("Function not implemented.");
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
budget: undefined,
|
|
162
|
-
description: undefined,
|
|
163
|
-
document: undefined,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function task(mockProject: MockProject, mockTask: MockTask): OsdkTodoTask {
|
|
168
|
-
return {
|
|
169
|
-
__apiName: "OsdkTodoTask",
|
|
170
|
-
__primaryKey: mockTask.id,
|
|
171
|
-
__rid: `${mockTask.id}`,
|
|
172
|
-
$apiName: "OsdkTodoTask",
|
|
173
|
-
$primaryKey: mockTask.id,
|
|
174
|
-
$rid: `${mockTask.id}`,
|
|
175
|
-
id: mockTask.id,
|
|
176
|
-
title: mockTask.name,
|
|
177
|
-
startDate: LocalDate.now(),
|
|
178
|
-
dueDate: LocalDate.now().plusWeeks(1),
|
|
179
|
-
status: "IN PROGRESS",
|
|
180
|
-
projectId: mockProject.id,
|
|
181
|
-
osdkTodoProject: {
|
|
182
|
-
get: async () => ({
|
|
183
|
-
type: "ok",
|
|
184
|
-
value: project(mockProject),
|
|
185
|
-
}),
|
|
186
|
-
fetchOneWithErrors: () => {
|
|
187
|
-
throw new Error("Function not implemented.");
|
|
188
|
-
},
|
|
189
|
-
fetchOne: () => {
|
|
190
|
-
throw new Error("Function not implemented.");
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
description: undefined,
|
|
194
|
-
assignedTo: undefined,
|
|
195
|
-
createdAt: undefined,
|
|
196
|
-
createdBy: undefined,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const Mocks = {
|
|
201
|
-
getProjects,
|
|
202
|
-
createProject,
|
|
203
|
-
deleteProject,
|
|
204
|
-
createTask,
|
|
205
|
-
deleteTask,
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export default Mocks;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|