@base44-preview/cli 0.1.5-pr.576.5e79c21 → 0.1.5-pr.577.1701370
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/bin/binary-entry.ts +2 -6
- package/dist/assets/{backend-runtime → deno-runtime}/main.ts +3 -59
- package/dist/cli/index.js +31 -108
- package/dist/cli/index.js.map +6 -7
- package/package.json +1 -1
- package/dist/assets/backend-runtime/base44-runtime.ts +0 -56
- package/dist/assets/backend-runtime/import-map.json +0 -5
- /package/dist/assets/{backend-runtime → deno-runtime}/exec.ts +0 -0
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local implementation of the `base44:runtime` module.
|
|
3
|
-
*
|
|
4
|
-
* Deployed backend functions import this module by its bare specifier
|
|
5
|
-
* (`import { secrets } from "base44:runtime"`). No such module exists on a
|
|
6
|
-
* developer machine, so `deno.json` maps the specifier onto this file and
|
|
7
|
-
* `base44 dev` hands that import map to the Deno subprocess.
|
|
8
|
-
*
|
|
9
|
-
* The surface mirrors production; the deliberate differences are called out on
|
|
10
|
-
* each export below.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* App secrets.
|
|
15
|
-
*
|
|
16
|
-
* Deployed, these are read from the Worker env binding of the current request.
|
|
17
|
-
* Locally they come from the environment `base44 dev` was started with —
|
|
18
|
-
* values stored with `base44 secrets set` are deliberately not fetched, so a
|
|
19
|
-
* production secret is never copied onto a developer machine. Export the
|
|
20
|
-
* variable in your shell to exercise a function that reads it.
|
|
21
|
-
*
|
|
22
|
-
* Returns `undefined` for an unset name rather than throwing, matching the
|
|
23
|
-
* deployed signature. Code that needs a secret should construct inside the
|
|
24
|
-
* handler: at module scope a client built from `undefined` throws during boot,
|
|
25
|
-
* where no try/catch is reached and nothing is logged.
|
|
26
|
-
*/
|
|
27
|
-
export const secrets: { get(name: string): string | undefined } = {
|
|
28
|
-
get(name: string): string | undefined {
|
|
29
|
-
return Deno.env.get(name);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Holds a strong reference to in-flight work so a floating promise cannot be
|
|
34
|
-
// collected before it settles.
|
|
35
|
-
const pending = new Set<Promise<unknown>>();
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Continue work after the response has been sent.
|
|
39
|
-
*
|
|
40
|
-
* Deployed, this rides `ctx.waitUntil` to extend the invocation until the
|
|
41
|
-
* promise settles. Locally the function is a long-lived server process, so
|
|
42
|
-
* there is nothing to hold open; the promise is tracked only so a rejection is
|
|
43
|
-
* reported against the function instead of surfacing as an unhandled
|
|
44
|
-
* rejection. Returns the same promise so it composes, as in production.
|
|
45
|
-
*/
|
|
46
|
-
export function waitUntil<T>(promise: Promise<T>): Promise<T> {
|
|
47
|
-
const tracked = Promise.resolve(promise)
|
|
48
|
-
.catch((error: unknown) => {
|
|
49
|
-
console.error("[base44:runtime] waitUntil task failed:", error);
|
|
50
|
-
})
|
|
51
|
-
.finally(() => {
|
|
52
|
-
pending.delete(tracked);
|
|
53
|
-
});
|
|
54
|
-
pending.add(tracked);
|
|
55
|
-
return promise;
|
|
56
|
-
}
|
|
File without changes
|