@osdk/create-app 0.15.0 → 0.16.0-main-20240520210317

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/bin/createOsdkApp.mjs +1 -1
  3. package/build/{js/index.browser.mjs → browser/index.js} +2 -2
  4. package/build/browser/index.js.map +1 -0
  5. package/build/{js → cjs}/index.cjs +1 -1
  6. package/build/cjs/index.cjs.map +1 -0
  7. package/build/{js/index.mjs → esm/index.js} +2 -2
  8. package/build/esm/index.js.map +1 -0
  9. package/package.json +12 -12
  10. package/templates/template-next-static-export/package.json.hbs +1 -1
  11. package/templates/template-react/package.json.hbs +6 -6
  12. package/templates/template-tutorial-todo-app/package.json.hbs +6 -6
  13. package/templates/template-tutorial-todo-app/src/{CreateTaskButton.tsx.hbs → CreateTaskButton.tsx} +2 -2
  14. package/templates/template-tutorial-todo-app/src/{CreateTaskDialog.tsx.hbs → CreateTaskDialog.tsx} +2 -2
  15. package/templates/template-tutorial-todo-app/src/{DeleteProjectButton.tsx.hbs → DeleteProjectButton.tsx} +2 -2
  16. package/templates/template-tutorial-todo-app/src/{DeleteProjectDialog.tsx.hbs → DeleteProjectDialog.tsx} +2 -2
  17. package/templates/template-tutorial-todo-app/src/{Home.tsx.hbs → Home.tsx} +2 -2
  18. package/templates/template-tutorial-todo-app/src/{ProjectSelect.tsx.hbs → ProjectSelect.tsx} +4 -4
  19. package/templates/template-tutorial-todo-app/src/{TaskList.tsx.hbs → TaskList.tsx} +2 -2
  20. package/templates/template-tutorial-todo-app/src/{TaskListItem.tsx.hbs → TaskListItem.tsx} +3 -3
  21. package/templates/template-tutorial-todo-app/src/mocks.ts +137 -0
  22. package/templates/template-tutorial-todo-app/src/{useProjectTasks.ts.hbs → useProjectTasks.ts} +13 -17
  23. package/templates/template-tutorial-todo-app/src/{useProjects.ts.hbs → useProjects.ts} +6 -7
  24. package/templates/template-vue/package.json.hbs +1 -1
  25. package/build/js/index.browser.mjs.map +0 -1
  26. package/build/js/index.cjs.map +0 -1
  27. package/build/js/index.mjs.map +0 -1
  28. package/templates/template-tutorial-todo-app/src/mocks.ts.hbs +0 -208
  29. /package/build/{types → esm}/cli.d.ts +0 -0
  30. /package/build/{types → esm}/cli.d.ts.map +0 -0
  31. /package/build/{types → esm}/cli.test.d.ts +0 -0
  32. /package/build/{types → esm}/cli.test.d.ts.map +0 -0
  33. /package/build/{types → esm}/consola.d.ts +0 -0
  34. /package/build/{types → esm}/consola.d.ts.map +0 -0
  35. /package/build/{types → esm}/generate/generateEnv.d.ts +0 -0
  36. /package/build/{types → esm}/generate/generateEnv.d.ts.map +0 -0
  37. /package/build/{types → esm}/generate/generateEnv.test.d.ts +0 -0
  38. /package/build/{types → esm}/generate/generateEnv.test.d.ts.map +0 -0
  39. /package/build/{types → esm}/generate/generateFoundryConfigJson.d.ts +0 -0
  40. /package/build/{types → esm}/generate/generateFoundryConfigJson.d.ts.map +0 -0
  41. /package/build/{types → esm}/generate/generateFoundryConfigJson.test.d.ts +0 -0
  42. /package/build/{types → esm}/generate/generateFoundryConfigJson.test.d.ts.map +0 -0
  43. /package/build/{types → esm}/generate/generateNpmRc.d.ts +0 -0
  44. /package/build/{types → esm}/generate/generateNpmRc.d.ts.map +0 -0
  45. /package/build/{types → esm}/generate/generateNpmRc.test.d.ts +0 -0
  46. /package/build/{types → esm}/generate/generateNpmRc.test.d.ts.map +0 -0
  47. /package/build/{types → esm}/highlight.d.ts +0 -0
  48. /package/build/{types → esm}/highlight.d.ts.map +0 -0
  49. /package/build/{types → esm}/index.d.ts +0 -0
  50. /package/build/{types → esm}/index.d.ts.map +0 -0
  51. /package/build/{types → esm}/prompts/promptApplicationRid.d.ts +0 -0
  52. /package/build/{types → esm}/prompts/promptApplicationRid.d.ts.map +0 -0
  53. /package/build/{types → esm}/prompts/promptApplicationRid.test.d.ts +0 -0
  54. /package/build/{types → esm}/prompts/promptApplicationRid.test.d.ts.map +0 -0
  55. /package/build/{types → esm}/prompts/promptApplicationUrl.d.ts +0 -0
  56. /package/build/{types → esm}/prompts/promptApplicationUrl.d.ts.map +0 -0
  57. /package/build/{types → esm}/prompts/promptApplicationUrl.test.d.ts +0 -0
  58. /package/build/{types → esm}/prompts/promptApplicationUrl.test.d.ts.map +0 -0
  59. /package/build/{types → esm}/prompts/promptClientId.d.ts +0 -0
  60. /package/build/{types → esm}/prompts/promptClientId.d.ts.map +0 -0
  61. /package/build/{types → esm}/prompts/promptClientId.test.d.ts +0 -0
  62. /package/build/{types → esm}/prompts/promptClientId.test.d.ts.map +0 -0
  63. /package/build/{types → esm}/prompts/promptCorsProxy.d.ts +0 -0
  64. /package/build/{types → esm}/prompts/promptCorsProxy.d.ts.map +0 -0
  65. /package/build/{types → esm}/prompts/promptCorsProxy.test.d.ts +0 -0
  66. /package/build/{types → esm}/prompts/promptCorsProxy.test.d.ts.map +0 -0
  67. /package/build/{types → esm}/prompts/promptFoundryUrl.d.ts +0 -0
  68. /package/build/{types → esm}/prompts/promptFoundryUrl.d.ts.map +0 -0
  69. /package/build/{types → esm}/prompts/promptFoundryUrl.test.d.ts +0 -0
  70. /package/build/{types → esm}/prompts/promptFoundryUrl.test.d.ts.map +0 -0
  71. /package/build/{types → esm}/prompts/promptOsdkPackage.d.ts +0 -0
  72. /package/build/{types → esm}/prompts/promptOsdkPackage.d.ts.map +0 -0
  73. /package/build/{types → esm}/prompts/promptOsdkPackage.test.d.ts +0 -0
  74. /package/build/{types → esm}/prompts/promptOsdkPackage.test.d.ts.map +0 -0
  75. /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.d.ts +0 -0
  76. /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.d.ts.map +0 -0
  77. /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.test.d.ts +0 -0
  78. /package/build/{types → esm}/prompts/promptOsdkRegistryUrl.test.d.ts.map +0 -0
  79. /package/build/{types → esm}/prompts/promptOverwrite.d.ts +0 -0
  80. /package/build/{types → esm}/prompts/promptOverwrite.d.ts.map +0 -0
  81. /package/build/{types → esm}/prompts/promptOverwrite.test.d.ts +0 -0
  82. /package/build/{types → esm}/prompts/promptOverwrite.test.d.ts.map +0 -0
  83. /package/build/{types → esm}/prompts/promptProject.d.ts +0 -0
  84. /package/build/{types → esm}/prompts/promptProject.d.ts.map +0 -0
  85. /package/build/{types → esm}/prompts/promptProject.test.d.ts +0 -0
  86. /package/build/{types → esm}/prompts/promptProject.test.d.ts.map +0 -0
  87. /package/build/{types → esm}/prompts/promptTemplate.d.ts +0 -0
  88. /package/build/{types → esm}/prompts/promptTemplate.d.ts.map +0 -0
  89. /package/build/{types → esm}/prompts/promptTemplate.test.d.ts +0 -0
  90. /package/build/{types → esm}/prompts/promptTemplate.test.d.ts.map +0 -0
  91. /package/build/{types → esm}/run.d.ts +0 -0
  92. /package/build/{types → esm}/run.d.ts.map +0 -0
  93. /package/build/{types → esm}/templates.d.ts +0 -0
  94. /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