@encore.dev/sdk 0.0.0 → 2.0.0-beta.5
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/LICENSE +362 -0
- package/README.md +122 -2
- package/app_meta.test.ts +134 -0
- package/app_meta.ts +186 -0
- package/config/config.test.ts +381 -0
- package/config/config.ts +178 -0
- package/config/mod.ts +14 -0
- package/config/secrets.ts +147 -0
- package/config/value.ts +243 -0
- package/cron/mod.ts +23 -0
- package/dist/app_meta.d.ts +93 -0
- package/dist/app_meta.js +65 -0
- package/dist/app_meta.js.map +1 -0
- package/dist/config/config.d.ts +105 -0
- package/dist/config/config.js +87 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/mod.d.ts +4 -0
- package/dist/config/mod.js +3 -0
- package/dist/config/mod.js.map +1 -0
- package/dist/config/secrets.d.ts +92 -0
- package/dist/config/secrets.js +80 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/config/value.d.ts +51 -0
- package/dist/config/value.js +178 -0
- package/dist/config/value.js.map +1 -0
- package/dist/cron/mod.d.ts +22 -0
- package/dist/cron/mod.js +9 -0
- package/dist/cron/mod.js.map +1 -0
- package/dist/internal/otel/backend.d.ts +50 -0
- package/dist/internal/otel/backend.js +2 -0
- package/dist/internal/otel/backend.js.map +1 -0
- package/dist/internal/otel/context.d.ts +10 -0
- package/dist/internal/otel/context.js +34 -0
- package/dist/internal/otel/context.js.map +1 -0
- package/dist/internal/otel/context_manager.d.ts +22 -0
- package/dist/internal/otel/context_manager.js +120 -0
- package/dist/internal/otel/context_manager.js.map +1 -0
- package/dist/internal/otel/encode.d.ts +112 -0
- package/dist/internal/otel/encode.js +290 -0
- package/dist/internal/otel/encode.js.map +1 -0
- package/dist/internal/otel/index.d.ts +9 -0
- package/dist/internal/otel/index.js +9 -0
- package/dist/internal/otel/index.js.map +1 -0
- package/dist/internal/otel/meter.d.ts +73 -0
- package/dist/internal/otel/meter.js +265 -0
- package/dist/internal/otel/meter.js.map +1 -0
- package/dist/internal/otel/propagator.d.ts +14 -0
- package/dist/internal/otel/propagator.js +61 -0
- package/dist/internal/otel/propagator.js.map +1 -0
- package/dist/internal/otel/provider.d.ts +9 -0
- package/dist/internal/otel/provider.js +19 -0
- package/dist/internal/otel/provider.js.map +1 -0
- package/dist/internal/otel/request_context.d.ts +11 -0
- package/dist/internal/otel/request_context.js +20 -0
- package/dist/internal/otel/request_context.js.map +1 -0
- package/dist/internal/otel/span.d.ts +61 -0
- package/dist/internal/otel/span.js +206 -0
- package/dist/internal/otel/span.js.map +1 -0
- package/dist/internal/otel/tracer.d.ts +15 -0
- package/dist/internal/otel/tracer.js +65 -0
- package/dist/internal/otel/tracer.js.map +1 -0
- package/dist/internal/reqtrack/mod.d.ts +6 -0
- package/dist/internal/reqtrack/mod.js +28 -0
- package/dist/internal/reqtrack/mod.js.map +1 -0
- package/dist/internal/runtime/meter.d.ts +11 -0
- package/dist/internal/runtime/meter.js +22 -0
- package/dist/internal/runtime/meter.js.map +1 -0
- package/dist/internal/runtime/mod.d.ts +12 -0
- package/dist/internal/runtime/mod.js +28 -0
- package/dist/internal/runtime/mod.js.map +1 -0
- package/dist/internal/runtime/napi/napi.cjs +122 -0
- package/dist/internal/runtime/napi/napi.d.cts +601 -0
- package/dist/internal/runtime/shutdown.d.ts +13 -0
- package/dist/internal/runtime/shutdown.js +56 -0
- package/dist/internal/runtime/shutdown.js.map +1 -0
- package/dist/internal/utils/constraints.d.ts +9 -0
- package/dist/internal/utils/constraints.js +2 -0
- package/dist/internal/utils/constraints.js.map +1 -0
- package/dist/log/index.d.ts +39 -0
- package/dist/log/index.js +44 -0
- package/dist/log/index.js.map +1 -0
- package/dist/log/logger.d.ts +123 -0
- package/dist/log/logger.js +203 -0
- package/dist/log/logger.js.map +1 -0
- package/dist/log/runtime.d.ts +19 -0
- package/dist/log/runtime.js +22 -0
- package/dist/log/runtime.js.map +1 -0
- package/dist/log/stderr.d.ts +9 -0
- package/dist/log/stderr.js +25 -0
- package/dist/log/stderr.js.map +1 -0
- package/dist/metrics/mod.d.ts +315 -0
- package/dist/metrics/mod.js +488 -0
- package/dist/metrics/mod.js.map +1 -0
- package/dist/mod.d.ts +6 -0
- package/dist/mod.js +4 -0
- package/dist/mod.js.map +1 -0
- package/dist/otel.d.ts +9 -0
- package/dist/otel.js +13 -0
- package/dist/otel.js.map +1 -0
- package/dist/pubsub/encoding.d.ts +3 -0
- package/dist/pubsub/encoding.js +10 -0
- package/dist/pubsub/encoding.js.map +1 -0
- package/dist/pubsub/mod.d.ts +6 -0
- package/dist/pubsub/mod.js +3 -0
- package/dist/pubsub/mod.js.map +1 -0
- package/dist/pubsub/refs.d.ts +12 -0
- package/dist/pubsub/refs.js +11 -0
- package/dist/pubsub/refs.js.map +1 -0
- package/dist/pubsub/subscription.d.ts +128 -0
- package/dist/pubsub/subscription.js +39 -0
- package/dist/pubsub/subscription.js.map +1 -0
- package/dist/pubsub/topic.d.ts +148 -0
- package/dist/pubsub/topic.js +164 -0
- package/dist/pubsub/topic.js.map +1 -0
- package/dist/req_meta.d.ts +47 -0
- package/dist/req_meta.js +26 -0
- package/dist/req_meta.js.map +1 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/index.js +22 -0
- package/dist/services/index.js.map +1 -0
- package/dist/shutdown/mod.d.ts +23 -0
- package/dist/shutdown/mod.js +24 -0
- package/dist/shutdown/mod.js.map +1 -0
- package/dist/storage/objects/bucket.d.ts +216 -0
- package/dist/storage/objects/bucket.js +123 -0
- package/dist/storage/objects/bucket.js.map +1 -0
- package/dist/storage/objects/error.d.ts +14 -0
- package/dist/storage/objects/error.js +81 -0
- package/dist/storage/objects/error.js.map +1 -0
- package/dist/storage/objects/mod.d.ts +4 -0
- package/dist/storage/objects/mod.js +3 -0
- package/dist/storage/objects/mod.js.map +1 -0
- package/dist/storage/objects/refs.d.ts +31 -0
- package/dist/storage/objects/refs.js +20 -0
- package/dist/storage/objects/refs.js.map +1 -0
- package/dist/storage/postgres/database.d.ts +295 -0
- package/dist/storage/postgres/database.js +378 -0
- package/dist/storage/postgres/database.js.map +1 -0
- package/dist/storage/postgres/mod.d.ts +2 -0
- package/dist/storage/postgres/mod.js +2 -0
- package/dist/storage/postgres/mod.js.map +1 -0
- package/dist/storage/redis/commands.d.ts +573 -0
- package/dist/storage/redis/commands.js +637 -0
- package/dist/storage/redis/commands.js.map +1 -0
- package/dist/storage/redis/database.d.ts +302 -0
- package/dist/storage/redis/database.js +336 -0
- package/dist/storage/redis/database.js.map +1 -0
- package/dist/storage/redis/mod.d.ts +88 -0
- package/dist/storage/redis/mod.js +84 -0
- package/dist/storage/redis/mod.js.map +1 -0
- package/dist/storage/redis/native.d.ts +8 -0
- package/dist/storage/redis/native.js +11 -0
- package/dist/storage/redis/native.js.map +1 -0
- package/dist/storage/redis/options.d.ts +89 -0
- package/dist/storage/redis/options.js +53 -0
- package/dist/storage/redis/options.js.map +1 -0
- package/dist/storage/redis/pubsub.d.ts +53 -0
- package/dist/storage/redis/pubsub.js +88 -0
- package/dist/storage/redis/pubsub.js.map +1 -0
- package/dist/storage/redis/reply.d.ts +256 -0
- package/dist/storage/redis/reply.js +572 -0
- package/dist/storage/redis/reply.js.map +1 -0
- package/dist/storage/redis/scan.d.ts +11 -0
- package/dist/storage/redis/scan.js +76 -0
- package/dist/storage/redis/scan.js.map +1 -0
- package/dist/storage/redis/script.d.ts +91 -0
- package/dist/storage/redis/script.js +143 -0
- package/dist/storage/redis/script.js.map +1 -0
- package/dist/storage/redis/target.d.ts +47 -0
- package/dist/storage/redis/target.js +82 -0
- package/dist/storage/redis/target.js.map +1 -0
- package/dist/storage/redis/wire.d.ts +105 -0
- package/dist/storage/redis/wire.js +333 -0
- package/dist/storage/redis/wire.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/mod.d.ts +42 -0
- package/dist/types/mod.js +65 -0
- package/dist/types/mod.js.map +1 -0
- package/internal/otel/backend.ts +60 -0
- package/internal/otel/context.test.ts +70 -0
- package/internal/otel/context.ts +48 -0
- package/internal/otel/context_manager.test.ts +154 -0
- package/internal/otel/context_manager.ts +141 -0
- package/internal/otel/encode.test.ts +266 -0
- package/internal/otel/encode.ts +408 -0
- package/internal/otel/index.ts +20 -0
- package/internal/otel/meter.test.ts +231 -0
- package/internal/otel/meter.ts +332 -0
- package/internal/otel/propagator.test.ts +105 -0
- package/internal/otel/propagator.ts +68 -0
- package/internal/otel/provider.ts +23 -0
- package/internal/otel/request_context.ts +32 -0
- package/internal/otel/span.ts +252 -0
- package/internal/otel/tracer.test.ts +352 -0
- package/internal/otel/tracer.ts +104 -0
- package/internal/reqtrack/mod.ts +39 -0
- package/internal/runtime/meter.ts +26 -0
- package/internal/runtime/mod.ts +41 -0
- package/internal/runtime/napi/napi.cjs +122 -0
- package/internal/runtime/napi/napi.d.cts +601 -0
- package/internal/runtime/shutdown.test.ts +248 -0
- package/internal/runtime/shutdown.ts +64 -0
- package/internal/utils/constraints.ts +12 -0
- package/log/index.ts +107 -0
- package/log/logger.test.ts +194 -0
- package/log/logger.ts +308 -0
- package/log/runtime.test.ts +65 -0
- package/log/runtime.ts +40 -0
- package/log/stderr.test.ts +23 -0
- package/log/stderr.ts +24 -0
- package/metrics/export.test.ts +337 -0
- package/metrics/mod.test.ts +180 -0
- package/metrics/mod.ts +619 -0
- package/mod.ts +22 -0
- package/otel.test.ts +84 -0
- package/otel.ts +17 -0
- package/package.json +121 -5
- package/pubsub/encoding.ts +8 -0
- package/pubsub/mod.ts +14 -0
- package/pubsub/pubsub.test.ts +186 -0
- package/pubsub/refs.ts +22 -0
- package/pubsub/subscription.ts +180 -0
- package/pubsub/topic.test.ts +121 -0
- package/pubsub/topic.ts +212 -0
- package/req_meta.ts +75 -0
- package/services/index.test.ts +30 -0
- package/services/index.ts +21 -0
- package/shutdown/mod.ts +24 -0
- package/storage/objects/bucket.ts +338 -0
- package/storage/objects/error.ts +94 -0
- package/storage/objects/mod.ts +35 -0
- package/storage/objects/refs.ts +69 -0
- package/storage/postgres/database.integration.test.ts +175 -0
- package/storage/postgres/database.test.ts +241 -0
- package/storage/postgres/database.ts +497 -0
- package/storage/postgres/mod.ts +15 -0
- package/storage/redis/commands.ts +1221 -0
- package/storage/redis/database.ts +466 -0
- package/storage/redis/mod.ts +135 -0
- package/storage/redis/native.ts +11 -0
- package/storage/redis/options.ts +119 -0
- package/storage/redis/pubsub.ts +92 -0
- package/storage/redis/redis.test.ts +706 -0
- package/storage/redis/reply.ts +705 -0
- package/storage/redis/runtime.test.ts +233 -0
- package/storage/redis/scan.ts +125 -0
- package/storage/redis/script.ts +162 -0
- package/storage/redis/target.ts +131 -0
- package/storage/redis/wire.ts +369 -0
- package/types/mod.ts +92 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Decimal } from '../../types/mod.js';
|
|
2
|
+
import { printRuntimeLine } from '../../log/runtime.js';
|
|
3
|
+
import { watchShutdownSignals } from './shutdown.js';
|
|
4
|
+
import { Runtime, setRuntimeLogHandler } from './napi/napi.cjs';
|
|
5
|
+
export * from './napi/napi.cjs';
|
|
6
|
+
const testMode = process.env.NODE_ENV === 'test';
|
|
7
|
+
setRuntimeLogHandler(printRuntimeLine);
|
|
8
|
+
export const RT = new Runtime({
|
|
9
|
+
testMode,
|
|
10
|
+
typeConstructors: {
|
|
11
|
+
decimal: (val) => new Decimal(val),
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
if (!testMode)
|
|
15
|
+
watchShutdownSignals(RT);
|
|
16
|
+
export { runUntilShutdown } from './shutdown.js';
|
|
17
|
+
let cached = null;
|
|
18
|
+
export function runtimeConfig() {
|
|
19
|
+
if (cached === null) {
|
|
20
|
+
const cfg = RT.runtimeConfig();
|
|
21
|
+
cached = {
|
|
22
|
+
currentService: cfg.currentService,
|
|
23
|
+
services: cfg.services ?? {},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return cached;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/runtime/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AAE9D,cAAc,iBAAiB,CAAC;AAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAEjD,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,OAAO,CAAC;IAC5B,QAAQ;IACR,gBAAgB,EAAE;QAChB,OAAO,EAAE,CAAC,GAA6B,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC;KAC7D;CACF,CAAC,CAAC;AAEH,IAAI,CAAC,QAAQ;IAAE,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAExC,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAU5C,IAAI,MAAM,GAAyB,IAAI,CAAC;AACxC,MAAM,UAAU,aAAa;IAC3B,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;QAC/B,MAAM,GAAG;YACP,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;SAC7B,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// The version of the runtime this JS bundle was generated for.
|
|
2
|
+
const version = "v2.0.0-beta.5";
|
|
3
|
+
|
|
4
|
+
// Load the native module. ENCORE_RUNTIME_LIB overrides the location; by
|
|
5
|
+
// default the library is found by walking up from this file (which the
|
|
6
|
+
// module resolver has resolved to its real path, so this reaches the real
|
|
7
|
+
// @encore.dev/sdk package even when node_modules holds symlinks), checking each
|
|
8
|
+
// directory and its dist/ subdirectory — the library ships in the package's
|
|
9
|
+
// dist/ folder — making the package relocatable.
|
|
10
|
+
function findRuntimeLib() {
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
let dir = __dirname;
|
|
14
|
+
for (;;) {
|
|
15
|
+
for (const candidate of [
|
|
16
|
+
path.join(dir, "encore-runtime.node"),
|
|
17
|
+
path.join(dir, "dist", "encore-runtime.node")
|
|
18
|
+
]) {
|
|
19
|
+
if (fs.existsSync(candidate)) {
|
|
20
|
+
return candidate;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const parent = path.dirname(dir);
|
|
24
|
+
if (parent === dir) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`could not find the Encore runtime library ('encore-runtime.node') in ${__dirname} or any parent directory. Set the ENCORE_RUNTIME_LIB environment variable to its path.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
dir = parent;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const nativeModulePath = process.env.ENCORE_RUNTIME_LIB || findRuntimeLib();
|
|
33
|
+
const nativeModule = require(nativeModulePath);
|
|
34
|
+
|
|
35
|
+
// Load the exported objects from the native module.
|
|
36
|
+
const {
|
|
37
|
+
Bucket,
|
|
38
|
+
BucketObject,
|
|
39
|
+
CloudProvider,
|
|
40
|
+
CollectReply,
|
|
41
|
+
Config,
|
|
42
|
+
ConfigWatch,
|
|
43
|
+
Cursor,
|
|
44
|
+
Decimal,
|
|
45
|
+
EnvironmentType,
|
|
46
|
+
Instrument,
|
|
47
|
+
ListEntry,
|
|
48
|
+
ListIterator,
|
|
49
|
+
Meters,
|
|
50
|
+
ObjectAttrs,
|
|
51
|
+
ObjectErrorKind,
|
|
52
|
+
Pipeline,
|
|
53
|
+
PubSubMessage,
|
|
54
|
+
PubSubSubscription,
|
|
55
|
+
PubSubTopic,
|
|
56
|
+
QueryArgs,
|
|
57
|
+
RedisConnection,
|
|
58
|
+
RedisDatabase,
|
|
59
|
+
RedisSubscription,
|
|
60
|
+
Request,
|
|
61
|
+
Row,
|
|
62
|
+
Runtime,
|
|
63
|
+
SQLAccess,
|
|
64
|
+
SQLConn,
|
|
65
|
+
SQLDatabase,
|
|
66
|
+
Secret,
|
|
67
|
+
SqlConn,
|
|
68
|
+
SqlDatabase,
|
|
69
|
+
Transaction,
|
|
70
|
+
TypedObjectError,
|
|
71
|
+
encodeLog,
|
|
72
|
+
setRuntimeLogHandler,
|
|
73
|
+
} = nativeModule;
|
|
74
|
+
|
|
75
|
+
// Export the objects from the native module.
|
|
76
|
+
module.exports = {
|
|
77
|
+
Bucket,
|
|
78
|
+
BucketObject,
|
|
79
|
+
CloudProvider,
|
|
80
|
+
CollectReply,
|
|
81
|
+
Config,
|
|
82
|
+
ConfigWatch,
|
|
83
|
+
Cursor,
|
|
84
|
+
Decimal,
|
|
85
|
+
EnvironmentType,
|
|
86
|
+
Instrument,
|
|
87
|
+
ListEntry,
|
|
88
|
+
ListIterator,
|
|
89
|
+
Meters,
|
|
90
|
+
ObjectAttrs,
|
|
91
|
+
ObjectErrorKind,
|
|
92
|
+
Pipeline,
|
|
93
|
+
PubSubMessage,
|
|
94
|
+
PubSubSubscription,
|
|
95
|
+
PubSubTopic,
|
|
96
|
+
QueryArgs,
|
|
97
|
+
RedisConnection,
|
|
98
|
+
RedisDatabase,
|
|
99
|
+
RedisSubscription,
|
|
100
|
+
Request,
|
|
101
|
+
Row,
|
|
102
|
+
Runtime,
|
|
103
|
+
SQLAccess,
|
|
104
|
+
SQLConn,
|
|
105
|
+
SQLDatabase,
|
|
106
|
+
Secret,
|
|
107
|
+
SqlConn,
|
|
108
|
+
SqlDatabase,
|
|
109
|
+
Transaction,
|
|
110
|
+
TypedObjectError,
|
|
111
|
+
encodeLog,
|
|
112
|
+
setRuntimeLogHandler,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// Sanity check incase the JS bundle was built for a different version of the runtime.
|
|
117
|
+
if (version !== Runtime.version()) {
|
|
118
|
+
console.warn(`⚠️ WARNING: The version of the Encore runtime this JS bundle was built for (${version}) does not match the version of the Encore runtime it is running in (${Runtime.version()}).
|
|
119
|
+
This may cause unexpected behaviour in your application.
|
|
120
|
+
|
|
121
|
+
To resolve this, try update your Encore CLI using "encore version update" and then update the dependencies in your package.json file using "npm install @encore.dev/sdk@latest" (and "npm install encore.dev@latest" if you use the API framework).`);
|
|
122
|
+
}
|