@base44-preview/cli 0.0.1-pr.10.77d2052

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 (134) hide show
  1. package/README.md +49 -0
  2. package/dist/cli/commands/auth/login.d.ts +3 -0
  3. package/dist/cli/commands/auth/login.d.ts.map +1 -0
  4. package/dist/cli/commands/auth/login.js +69 -0
  5. package/dist/cli/commands/auth/login.js.map +1 -0
  6. package/dist/cli/commands/auth/logout.d.ts +3 -0
  7. package/dist/cli/commands/auth/logout.d.ts.map +1 -0
  8. package/dist/cli/commands/auth/logout.js +14 -0
  9. package/dist/cli/commands/auth/logout.js.map +1 -0
  10. package/dist/cli/commands/auth/whoami.d.ts +3 -0
  11. package/dist/cli/commands/auth/whoami.d.ts.map +1 -0
  12. package/dist/cli/commands/auth/whoami.js +14 -0
  13. package/dist/cli/commands/auth/whoami.js.map +1 -0
  14. package/dist/cli/commands/project/show-project.d.ts +3 -0
  15. package/dist/cli/commands/project/show-project.d.ts.map +1 -0
  16. package/dist/cli/commands/project/show-project.js +20 -0
  17. package/dist/cli/commands/project/show-project.js.map +1 -0
  18. package/dist/cli/index.d.ts +3 -0
  19. package/dist/cli/index.d.ts.map +1 -0
  20. package/dist/cli/index.js +21 -0
  21. package/dist/cli/index.js.map +1 -0
  22. package/dist/cli/utils/index.d.ts +4 -0
  23. package/dist/cli/utils/index.d.ts.map +1 -0
  24. package/dist/cli/utils/index.js +4 -0
  25. package/dist/cli/utils/index.js.map +1 -0
  26. package/dist/cli/utils/packageVersion.d.ts +2 -0
  27. package/dist/cli/utils/packageVersion.d.ts.map +1 -0
  28. package/dist/cli/utils/packageVersion.js +12 -0
  29. package/dist/cli/utils/packageVersion.js.map +1 -0
  30. package/dist/cli/utils/runCommand.d.ts +8 -0
  31. package/dist/cli/utils/runCommand.d.ts.map +1 -0
  32. package/dist/cli/utils/runCommand.js +25 -0
  33. package/dist/cli/utils/runCommand.js.map +1 -0
  34. package/dist/cli/utils/runTask.d.ts +14 -0
  35. package/dist/cli/utils/runTask.d.ts.map +1 -0
  36. package/dist/cli/utils/runTask.js +24 -0
  37. package/dist/cli/utils/runTask.js.map +1 -0
  38. package/dist/core/auth/api.d.ts +5 -0
  39. package/dist/core/auth/api.d.ts.map +1 -0
  40. package/dist/core/auth/api.js +81 -0
  41. package/dist/core/auth/api.js.map +1 -0
  42. package/dist/core/auth/authClient.d.ts +7 -0
  43. package/dist/core/auth/authClient.d.ts.map +1 -0
  44. package/dist/core/auth/authClient.js +14 -0
  45. package/dist/core/auth/authClient.js.map +1 -0
  46. package/dist/core/auth/config.d.ts +11 -0
  47. package/dist/core/auth/config.d.ts.map +1 -0
  48. package/dist/core/auth/config.js +70 -0
  49. package/dist/core/auth/config.js.map +1 -0
  50. package/dist/core/auth/index.d.ts +4 -0
  51. package/dist/core/auth/index.d.ts.map +1 -0
  52. package/dist/core/auth/index.js +4 -0
  53. package/dist/core/auth/index.js.map +1 -0
  54. package/dist/core/auth/schema.d.ts +63 -0
  55. package/dist/core/auth/schema.d.ts.map +1 -0
  56. package/dist/core/auth/schema.js +62 -0
  57. package/dist/core/auth/schema.js.map +1 -0
  58. package/dist/core/config/app.d.ts +22 -0
  59. package/dist/core/config/app.d.ts.map +1 -0
  60. package/dist/core/config/app.js +14 -0
  61. package/dist/core/config/app.js.map +1 -0
  62. package/dist/core/config/index.d.ts +4 -0
  63. package/dist/core/config/index.d.ts.map +1 -0
  64. package/dist/core/config/index.js +3 -0
  65. package/dist/core/config/index.js.map +1 -0
  66. package/dist/core/config/project.d.ts +25 -0
  67. package/dist/core/config/project.d.ts.map +1 -0
  68. package/dist/core/config/project.js +62 -0
  69. package/dist/core/config/project.js.map +1 -0
  70. package/dist/core/config/resource.d.ts +4 -0
  71. package/dist/core/config/resource.d.ts.map +1 -0
  72. package/dist/core/config/resource.js +2 -0
  73. package/dist/core/config/resource.js.map +1 -0
  74. package/dist/core/consts.d.ts +8 -0
  75. package/dist/core/consts.d.ts.map +1 -0
  76. package/dist/core/consts.js +24 -0
  77. package/dist/core/consts.js.map +1 -0
  78. package/dist/core/errors.d.ts +8 -0
  79. package/dist/core/errors.d.ts.map +1 -0
  80. package/dist/core/errors.js +15 -0
  81. package/dist/core/errors.js.map +1 -0
  82. package/dist/core/index.d.ts +6 -0
  83. package/dist/core/index.d.ts.map +1 -0
  84. package/dist/core/index.js +6 -0
  85. package/dist/core/index.js.map +1 -0
  86. package/dist/core/resources/entity/config.d.ts +3 -0
  87. package/dist/core/resources/entity/config.d.ts.map +1 -0
  88. package/dist/core/resources/entity/config.js +25 -0
  89. package/dist/core/resources/entity/config.js.map +1 -0
  90. package/dist/core/resources/entity/index.d.ts +4 -0
  91. package/dist/core/resources/entity/index.d.ts.map +1 -0
  92. package/dist/core/resources/entity/index.js +4 -0
  93. package/dist/core/resources/entity/index.js.map +1 -0
  94. package/dist/core/resources/entity/resource.d.ts +4 -0
  95. package/dist/core/resources/entity/resource.d.ts.map +1 -0
  96. package/dist/core/resources/entity/resource.js +5 -0
  97. package/dist/core/resources/entity/resource.js.map +1 -0
  98. package/dist/core/resources/entity/schema.d.ts +47 -0
  99. package/dist/core/resources/entity/schema.d.ts.map +1 -0
  100. package/dist/core/resources/entity/schema.js +29 -0
  101. package/dist/core/resources/entity/schema.js.map +1 -0
  102. package/dist/core/resources/function/config.d.ts +4 -0
  103. package/dist/core/resources/function/config.d.ts.map +1 -0
  104. package/dist/core/resources/function/config.js +26 -0
  105. package/dist/core/resources/function/config.js.map +1 -0
  106. package/dist/core/resources/function/index.d.ts +4 -0
  107. package/dist/core/resources/function/index.d.ts.map +1 -0
  108. package/dist/core/resources/function/index.js +4 -0
  109. package/dist/core/resources/function/index.js.map +1 -0
  110. package/dist/core/resources/function/resource.d.ts +4 -0
  111. package/dist/core/resources/function/resource.d.ts.map +1 -0
  112. package/dist/core/resources/function/resource.js +5 -0
  113. package/dist/core/resources/function/resource.js.map +1 -0
  114. package/dist/core/resources/function/schema.d.ts +91 -0
  115. package/dist/core/resources/function/schema.d.ts.map +1 -0
  116. package/dist/core/resources/function/schema.js +36 -0
  117. package/dist/core/resources/function/schema.js.map +1 -0
  118. package/dist/core/resources/index.d.ts +3 -0
  119. package/dist/core/resources/index.d.ts.map +1 -0
  120. package/dist/core/resources/index.js +3 -0
  121. package/dist/core/resources/index.js.map +1 -0
  122. package/dist/core/utils/fs.d.ts +5 -0
  123. package/dist/core/utils/fs.d.ts.map +1 -0
  124. package/dist/core/utils/fs.js +56 -0
  125. package/dist/core/utils/fs.js.map +1 -0
  126. package/dist/core/utils/httpClient.d.ts +3 -0
  127. package/dist/core/utils/httpClient.d.ts.map +1 -0
  128. package/dist/core/utils/httpClient.js +41 -0
  129. package/dist/core/utils/httpClient.js.map +1 -0
  130. package/dist/core/utils/index.d.ts +3 -0
  131. package/dist/core/utils/index.d.ts.map +1 -0
  132. package/dist/core/utils/index.js +3 -0
  133. package/dist/core/utils/index.js.map +1 -0
  134. package/package.json +65 -0
@@ -0,0 +1,26 @@
1
+ import { globby } from "globby";
2
+ import { FUNCTION_CONFIG_FILE } from "../../consts.js";
3
+ import { readJsonFile, pathExists } from "../../utils/fs.js";
4
+ import { FunctionConfigSchema } from "./schema.js";
5
+ export async function readFunctionConfig(configPath) {
6
+ const parsed = await readJsonFile(configPath);
7
+ const result = FunctionConfigSchema.safeParse(parsed);
8
+ if (!result.success) {
9
+ throw new Error(`Invalid function configuration in ${configPath}: ${result.error.issues
10
+ .map((e) => e.message)
11
+ .join(", ")}`);
12
+ }
13
+ return result.data;
14
+ }
15
+ export async function readAllFunctions(functionsDir) {
16
+ if (!(await pathExists(functionsDir))) {
17
+ return [];
18
+ }
19
+ const configFiles = await globby(`*/${FUNCTION_CONFIG_FILE}`, {
20
+ cwd: functionsDir,
21
+ absolute: true,
22
+ });
23
+ const functionConfigs = await Promise.all(configFiles.map((configPath) => readFunctionConfig(configPath)));
24
+ return functionConfigs;
25
+ }
26
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1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;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./schema.js";
2
+ export * from "./config.js";
3
+ export * from "./resource.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/resources/function/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./schema.js";
2
+ export * from "./config.js";
3
+ export * from "./resource.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/resources/function/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Resource } from "../../config/resource.js";
2
+ import type { FunctionConfig } from "./schema.js";
3
+ export declare const functionResource: Resource<FunctionConfig>;
4
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../../src/core/resources/function/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAErD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { readAllFunctions } from "./config.js";
2
+ export const functionResource = {
3
+ readAll: readAllFunctions,
4
+ };
5
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../../src/core/resources/function/resource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,OAAO,EAAE,gBAAgB;CAC1B,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+ declare const HttpTriggerSchema: z.ZodObject<{
3
+ id: z.ZodOptional<z.ZodString>;
4
+ name: z.ZodOptional<z.ZodString>;
5
+ description: z.ZodOptional<z.ZodString>;
6
+ type: z.ZodLiteral<"http">;
7
+ path: z.ZodString;
8
+ }, z.core.$strip>;
9
+ declare const ScheduleTriggerSchema: z.ZodObject<{
10
+ id: z.ZodOptional<z.ZodString>;
11
+ name: z.ZodOptional<z.ZodString>;
12
+ description: z.ZodOptional<z.ZodString>;
13
+ type: z.ZodLiteral<"schedule">;
14
+ scheduleMode: z.ZodOptional<z.ZodEnum<{
15
+ recurring: "recurring";
16
+ once: "once";
17
+ }>>;
18
+ cron: z.ZodString;
19
+ isActive: z.ZodOptional<z.ZodBoolean>;
20
+ timezone: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ declare const EventTriggerSchema: z.ZodObject<{
23
+ id: z.ZodOptional<z.ZodString>;
24
+ name: z.ZodOptional<z.ZodString>;
25
+ description: z.ZodOptional<z.ZodString>;
26
+ type: z.ZodLiteral<"event">;
27
+ entity: z.ZodString;
28
+ event: z.ZodString;
29
+ }, z.core.$strip>;
30
+ declare const TriggerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
31
+ id: z.ZodOptional<z.ZodString>;
32
+ name: z.ZodOptional<z.ZodString>;
33
+ description: z.ZodOptional<z.ZodString>;
34
+ type: z.ZodLiteral<"http">;
35
+ path: z.ZodString;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ id: z.ZodOptional<z.ZodString>;
38
+ name: z.ZodOptional<z.ZodString>;
39
+ description: z.ZodOptional<z.ZodString>;
40
+ type: z.ZodLiteral<"schedule">;
41
+ scheduleMode: z.ZodOptional<z.ZodEnum<{
42
+ recurring: "recurring";
43
+ once: "once";
44
+ }>>;
45
+ cron: z.ZodString;
46
+ isActive: z.ZodOptional<z.ZodBoolean>;
47
+ timezone: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ id: z.ZodOptional<z.ZodString>;
50
+ name: z.ZodOptional<z.ZodString>;
51
+ description: z.ZodOptional<z.ZodString>;
52
+ type: z.ZodLiteral<"event">;
53
+ entity: z.ZodString;
54
+ event: z.ZodString;
55
+ }, z.core.$strip>], "type">;
56
+ export declare const FunctionConfigSchema: z.ZodObject<{
57
+ entry: z.ZodString;
58
+ triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
59
+ id: z.ZodOptional<z.ZodString>;
60
+ name: z.ZodOptional<z.ZodString>;
61
+ description: z.ZodOptional<z.ZodString>;
62
+ type: z.ZodLiteral<"http">;
63
+ path: z.ZodString;
64
+ }, z.core.$strip>, z.ZodObject<{
65
+ id: z.ZodOptional<z.ZodString>;
66
+ name: z.ZodOptional<z.ZodString>;
67
+ description: z.ZodOptional<z.ZodString>;
68
+ type: z.ZodLiteral<"schedule">;
69
+ scheduleMode: z.ZodOptional<z.ZodEnum<{
70
+ recurring: "recurring";
71
+ once: "once";
72
+ }>>;
73
+ cron: z.ZodString;
74
+ isActive: z.ZodOptional<z.ZodBoolean>;
75
+ timezone: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ id: z.ZodOptional<z.ZodString>;
78
+ name: z.ZodOptional<z.ZodString>;
79
+ description: z.ZodOptional<z.ZodString>;
80
+ type: z.ZodLiteral<"event">;
81
+ entity: z.ZodString;
82
+ event: z.ZodString;
83
+ }, z.core.$strip>], "type">>>;
84
+ }, z.core.$strip>;
85
+ export type HttpTrigger = z.infer<typeof HttpTriggerSchema>;
86
+ export type ScheduleTrigger = z.infer<typeof ScheduleTriggerSchema>;
87
+ export type EventTrigger = z.infer<typeof EventTriggerSchema>;
88
+ export type Trigger = z.infer<typeof TriggerSchema>;
89
+ export type FunctionConfig = z.infer<typeof FunctionConfigSchema>;
90
+ export {};
91
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/core/resources/function/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,iBAAiB;;;;;;iBAMrB,CAAC;AAEH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;iBASzB,CAAC;AAEH,QAAA,MAAM,kBAAkB;;;;;;;iBAOtB,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;2BAIjB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ const HttpTriggerSchema = z.object({
3
+ id: z.string().optional(),
4
+ name: z.string().optional(),
5
+ description: z.string().optional(),
6
+ type: z.literal("http"),
7
+ path: z.string().min(1, "Path cannot be empty"),
8
+ });
9
+ const ScheduleTriggerSchema = z.object({
10
+ id: z.string().optional(),
11
+ name: z.string().optional(),
12
+ description: z.string().optional(),
13
+ type: z.literal("schedule"),
14
+ scheduleMode: z.enum(["recurring", "once"]).optional(),
15
+ cron: z.string().min(1, "Cron expression cannot be empty"),
16
+ isActive: z.boolean().optional(),
17
+ timezone: z.string().optional(),
18
+ });
19
+ const EventTriggerSchema = z.object({
20
+ id: z.string().optional(),
21
+ name: z.string().optional(),
22
+ description: z.string().optional(),
23
+ type: z.literal("event"),
24
+ entity: z.string().min(1, "Entity name cannot be empty"),
25
+ event: z.string().min(1, "Event type cannot be empty"),
26
+ });
27
+ const TriggerSchema = z.discriminatedUnion("type", [
28
+ HttpTriggerSchema,
29
+ ScheduleTriggerSchema,
30
+ EventTriggerSchema,
31
+ ]);
32
+ export const FunctionConfigSchema = z.object({
33
+ entry: z.string().min(1, "Entry point cannot be empty"),
34
+ triggers: z.array(TriggerSchema).optional(),
35
+ });
36
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/core/resources/function/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MA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AQ,EAAE;CAC5C,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./entity/index.js";
2
+ export * from "./function/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./entity/index.js";
2
+ export * from "./function/index.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function pathExists(path: string): Promise<boolean>;
2
+ export declare function readJsonFile(filePath: string): Promise<unknown>;
3
+ export declare function writeJsonFile(filePath: string, data: unknown): Promise<void>;
4
+ export declare function deleteFile(filePath: string): Promise<void>;
5
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,oBAItC;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8BrE;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAchE"}
@@ -0,0 +1,56 @@
1
+ import { readFile, writeFile, mkdir, unlink, access } from "node:fs/promises";
2
+ import { dirname } from "node:path";
3
+ import { parse, printParseErrorCode } from "jsonc-parser";
4
+ export function pathExists(path) {
5
+ return access(path)
6
+ .then(() => true)
7
+ .catch(() => false);
8
+ }
9
+ export async function readJsonFile(filePath) {
10
+ if (!(await pathExists(filePath))) {
11
+ throw new Error(`File not found: ${filePath}`);
12
+ }
13
+ try {
14
+ const fileContent = await readFile(filePath, "utf-8");
15
+ const errors = [];
16
+ const result = parse(fileContent, errors, { allowTrailingComma: true });
17
+ if (errors.length > 0) {
18
+ const errorMessages = errors
19
+ .map((e) => `${printParseErrorCode(e.error)} at offset ${e.offset}`)
20
+ .join(", ");
21
+ throw new Error(`File contains invalid JSONC: ${filePath} (${errorMessages})`);
22
+ }
23
+ return result;
24
+ }
25
+ catch (error) {
26
+ if (error instanceof Error && error.message.includes("invalid JSONC")) {
27
+ throw error;
28
+ }
29
+ throw new Error(`Failed to read file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
30
+ }
31
+ }
32
+ export async function writeJsonFile(filePath, data) {
33
+ try {
34
+ const dir = dirname(filePath);
35
+ if (!(await pathExists(dir))) {
36
+ await mkdir(dir, { recursive: true });
37
+ }
38
+ const jsonContent = JSON.stringify(data, null, 2);
39
+ await writeFile(filePath, jsonContent, "utf-8");
40
+ }
41
+ catch (error) {
42
+ throw new Error(`Failed to write file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
43
+ }
44
+ }
45
+ export async function deleteFile(filePath) {
46
+ if (!(await pathExists(filePath))) {
47
+ return;
48
+ }
49
+ try {
50
+ await unlink(filePath);
51
+ }
52
+ catch (error) {
53
+ throw new Error(`Failed to delete file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
54
+ }
55
+ }
56
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO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EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const httpClient: import("ky").KyInstance;
2
+ export default httpClient;
3
+ //# sourceMappingURL=httpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/core/utils/httpClient.ts"],"names":[],"mappings":"AA6BA,QAAA,MAAM,UAAU,yBAkBd,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,41 @@
1
+ import ky from "ky";
2
+ import { getBase44ApiUrl } from "../consts.js";
3
+ import { readAuth, refreshAndSaveTokens } from "../auth/config.js";
4
+ /**
5
+ * Handles 401 responses by refreshing the token and retrying the request.
6
+ */
7
+ async function handleUnauthorized(request, _options, response) {
8
+ if (response.status !== 401) {
9
+ return;
10
+ }
11
+ const newAccessToken = await refreshAndSaveTokens();
12
+ if (!newAccessToken) {
13
+ // Refresh failed, let the 401 propagate
14
+ return;
15
+ }
16
+ // Retry the request with new token
17
+ request.headers.set("Authorization", `Bearer ${newAccessToken}`);
18
+ return ky(request);
19
+ }
20
+ const httpClient = ky.create({
21
+ prefixUrl: getBase44ApiUrl(),
22
+ headers: {
23
+ "User-Agent": "Base44 CLI",
24
+ },
25
+ hooks: {
26
+ beforeRequest: [
27
+ async (request) => {
28
+ try {
29
+ const auth = await readAuth();
30
+ request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
31
+ }
32
+ catch {
33
+ // No auth available, continue without header
34
+ }
35
+ },
36
+ ],
37
+ afterResponse: [handleUnauthorized],
38
+ },
39
+ });
40
+ export default httpClient;
41
+ //# sourceMappingURL=httpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpClient.js","sourceRoot":"","sources":["../../../src/core/utils/httpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;GAEG;AACH,KAAK,UAAU,kBAAkB,CAC/B,OAAkB,EAClB,QAA2B,EAC3B,QAAoB;IAEpB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAEpD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,wCAAwC;QACxC,OAAO;IACT,CAAC;IAED,mCAAmC;IACnC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,cAAc,EAAE,CAAC,CAAC;IACjE,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,GAAG,EAAE,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE,eAAe,EAAE;IAC5B,OAAO,EAAE;QACP,YAAY,EAAE,YAAY;KAC3B;IACD,KAAK,EAAE;QACL,aAAa,EAAE;YACb,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,IAAI,CAAC;oBACH,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;oBAC9B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;gBACrE,CAAC;gBAAC,MAAM,CAAC;oBACP,6CAA6C;gBAC/C,CAAC;YACH,CAAC;SACF;QACD,aAAa,EAAE,CAAC,kBAAkB,CAAC;KACpC;CACF,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./fs.js";
2
+ export * from "./httpClient.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./fs.js";
2
+ export * from "./httpClient.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@base44-preview/cli",
3
+ "version": "0.0.1-pr.10.77d2052",
4
+ "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
+ "type": "module",
6
+ "main": "./dist/cli/index.js",
7
+ "types": "./dist/cli/index.d.ts",
8
+ "bin": "./dist/cli/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/cli/index.d.ts",
12
+ "default": "./dist/cli/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc && tsc-alias",
20
+ "dev": "tsx src/cli/index.ts",
21
+ "start": "node dist/cli/index.js",
22
+ "clean": "rm -rf dist",
23
+ "lint": "eslint src",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest"
26
+ },
27
+ "keywords": [
28
+ "base44",
29
+ "cli",
30
+ "command-line"
31
+ ],
32
+ "author": "",
33
+ "license": "ISC",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/base44/cli"
37
+ },
38
+ "dependencies": {
39
+ "@clack/prompts": "^0.11.0",
40
+ "chalk": "^5.6.2",
41
+ "commander": "^12.1.0",
42
+ "globby": "^16.1.0",
43
+ "jsonc-parser": "^3.3.1",
44
+ "ky": "^1.14.2",
45
+ "p-wait-for": "^6.0.0",
46
+ "zod": "^4.3.5"
47
+ },
48
+ "devDependencies": {
49
+ "@stylistic/eslint-plugin": "^5.6.1",
50
+ "@types/node": "^22.10.5",
51
+ "@typescript-eslint/eslint-plugin": "^8.51.0",
52
+ "@typescript-eslint/parser": "^8.51.0",
53
+ "eslint": "^9.39.2",
54
+ "eslint-plugin-import": "^2.32.0",
55
+ "eslint-plugin-unicorn": "^62.0.0",
56
+ "tsc-alias": "^1.8.16",
57
+ "tsx": "^4.19.2",
58
+ "typescript": "^5.7.2",
59
+ "typescript-eslint": "^8.52.0",
60
+ "vitest": "^4.0.16"
61
+ },
62
+ "engines": {
63
+ "node": ">=20.19.0"
64
+ }
65
+ }