vercel-cli 41.1.0__py3-none-any.whl
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.
Potentially problematic release.
This version of vercel-cli might be problematic. Click here for more details.
- vercel_cli/vendor/LICENSE +202 -0
- vercel_cli/vendor/README.md +63 -0
- vercel_cli/vendor/dist/VERCEL_DIR_README.txt +11 -0
- vercel_cli/vendor/dist/builder-worker.js +62 -0
- vercel_cli/vendor/dist/get-latest-worker.js +272 -0
- vercel_cli/vendor/dist/index.js +172693 -0
- vercel_cli/vendor/dist/vc.js +11 -0
- vercel_cli/vendor/node_modules/.package-lock.json +18 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/CHANGELOG.md +488 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/LICENSE +202 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/build.mjs +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/clone-env.d.ts +10 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/clone-env.js +43 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/debug.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/debug.js +31 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/default-cache-path-glob.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/default-cache-path-glob.js +28 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/edge-function.d.ts +41 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/edge-function.js +40 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/errors.d.ts +39 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/errors.js +95 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-blob.d.ts +23 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-blob.js +67 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-fs-ref.d.ts +27 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-fs-ref.js +113 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-ref.d.ts +38 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/file-ref.js +147 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/download.d.ts +9 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/download.js +136 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/get-writable-directory.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/get-writable-directory.js +32 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/glob.d.ts +10 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/glob.js +111 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/node-version.d.ts +9 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/node-version.js +180 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/normalize-path.d.ts +4 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/normalize-path.js +31 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/read-config-file.js +76 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/rename.d.ts +11 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/rename.js +30 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.d.ts +206 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/run-user-scripts.js +944 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.d.ts +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.js +87 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-ignore-filter.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-ignore-filter.js +90 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-installed-package-version.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-installed-package-version.js +53 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-platform-env.d.ts +5 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-platform-env.js +45 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-prefixed-env-vars.d.ts +14 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/get-prefixed-env-vars.js +51 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/hard-link-dir.d.ts +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/hard-link-dir.js +104 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.d.ts +33 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/index.js +24390 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.d.ts +81 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/lambda.js +231 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/nodejs-lambda.d.ts +16 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/nodejs-lambda.js +44 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/os.d.ts +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/os.js +62 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/prerender.d.ts +37 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/prerender.js +169 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/schemas.d.ts +60 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/schemas.js +87 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/should-serve.d.ts +2 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/should-serve.js +47 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/constants.d.ts +2 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/constants.js +31 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/index.d.ts +3 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/index.js +33 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/trace.d.ts +37 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/trace/trace.js +92 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/types.d.ts +503 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/types.js +51 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/validate-npmrc.d.ts +12 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/dist/validate-npmrc.js +41 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/file-blob.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/file-fs-ref.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/file-ref.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/download.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/get-writable-directory.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/glob.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/rename.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/run-user-scripts.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/fs/stream-to-buffer.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/lambda.js +1 -0
- vercel_cli/vendor/node_modules/@vercel/build-utils/package.json +60 -0
- vercel_cli/vendor/node_modules/@vercel/python/LICENSE +202 -0
- vercel_cli/vendor/node_modules/@vercel/python/dist/index.js +3132 -0
- vercel_cli/vendor/node_modules/@vercel/python/package.json +36 -0
- vercel_cli/vendor/node_modules/@vercel/python/vc_init.py +681 -0
- vercel_cli/vendor/package.json +40 -0
- vercel_cli-41.1.0.dist-info/METADATA +188 -0
- vercel_cli-41.1.0.dist-info/RECORD +99 -0
- vercel_cli-41.1.0.dist-info/WHEEL +4 -0
- vercel_cli-41.1.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const functionsSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
minProperties: number;
|
|
4
|
+
maxProperties: number;
|
|
5
|
+
additionalProperties: boolean;
|
|
6
|
+
patternProperties: {
|
|
7
|
+
'^.{1,256}$': {
|
|
8
|
+
type: string;
|
|
9
|
+
additionalProperties: boolean;
|
|
10
|
+
properties: {
|
|
11
|
+
runtime: {
|
|
12
|
+
type: string;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
};
|
|
15
|
+
memory: {
|
|
16
|
+
minimum: number;
|
|
17
|
+
maximum: number;
|
|
18
|
+
};
|
|
19
|
+
maxDuration: {
|
|
20
|
+
type: string;
|
|
21
|
+
minimum: number;
|
|
22
|
+
maximum: number;
|
|
23
|
+
};
|
|
24
|
+
includeFiles: {
|
|
25
|
+
type: string;
|
|
26
|
+
maxLength: number;
|
|
27
|
+
};
|
|
28
|
+
excludeFiles: {
|
|
29
|
+
type: string;
|
|
30
|
+
maxLength: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare const buildsSchema: {
|
|
37
|
+
type: string;
|
|
38
|
+
minItems: number;
|
|
39
|
+
maxItems: number;
|
|
40
|
+
items: {
|
|
41
|
+
type: string;
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
required: string[];
|
|
44
|
+
properties: {
|
|
45
|
+
src: {
|
|
46
|
+
type: string;
|
|
47
|
+
minLength: number;
|
|
48
|
+
maxLength: number;
|
|
49
|
+
};
|
|
50
|
+
use: {
|
|
51
|
+
type: string;
|
|
52
|
+
minLength: number;
|
|
53
|
+
maxLength: number;
|
|
54
|
+
};
|
|
55
|
+
config: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var schemas_exports = {};
|
|
20
|
+
__export(schemas_exports, {
|
|
21
|
+
buildsSchema: () => buildsSchema,
|
|
22
|
+
functionsSchema: () => functionsSchema
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(schemas_exports);
|
|
25
|
+
const functionsSchema = {
|
|
26
|
+
type: "object",
|
|
27
|
+
minProperties: 1,
|
|
28
|
+
maxProperties: 50,
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
patternProperties: {
|
|
31
|
+
"^.{1,256}$": {
|
|
32
|
+
type: "object",
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
properties: {
|
|
35
|
+
runtime: {
|
|
36
|
+
type: "string",
|
|
37
|
+
maxLength: 256
|
|
38
|
+
},
|
|
39
|
+
memory: {
|
|
40
|
+
minimum: 128,
|
|
41
|
+
maximum: 3009
|
|
42
|
+
},
|
|
43
|
+
maxDuration: {
|
|
44
|
+
type: "number",
|
|
45
|
+
minimum: 1,
|
|
46
|
+
maximum: 900
|
|
47
|
+
},
|
|
48
|
+
includeFiles: {
|
|
49
|
+
type: "string",
|
|
50
|
+
maxLength: 256
|
|
51
|
+
},
|
|
52
|
+
excludeFiles: {
|
|
53
|
+
type: "string",
|
|
54
|
+
maxLength: 256
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const buildsSchema = {
|
|
61
|
+
type: "array",
|
|
62
|
+
minItems: 0,
|
|
63
|
+
maxItems: 128,
|
|
64
|
+
items: {
|
|
65
|
+
type: "object",
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
required: ["use"],
|
|
68
|
+
properties: {
|
|
69
|
+
src: {
|
|
70
|
+
type: "string",
|
|
71
|
+
minLength: 1,
|
|
72
|
+
maxLength: 4096
|
|
73
|
+
},
|
|
74
|
+
use: {
|
|
75
|
+
type: "string",
|
|
76
|
+
minLength: 3,
|
|
77
|
+
maxLength: 256
|
|
78
|
+
},
|
|
79
|
+
config: { type: "object" }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
buildsSchema,
|
|
86
|
+
functionsSchema
|
|
87
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var should_serve_exports = {};
|
|
20
|
+
__export(should_serve_exports, {
|
|
21
|
+
shouldServe: () => shouldServe
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(should_serve_exports);
|
|
24
|
+
var import_path = require("path");
|
|
25
|
+
const shouldServe = ({
|
|
26
|
+
entrypoint,
|
|
27
|
+
files,
|
|
28
|
+
requestPath
|
|
29
|
+
}) => {
|
|
30
|
+
requestPath = requestPath.replace(/\/$/, "");
|
|
31
|
+
entrypoint = entrypoint.replace(/\\/, "/");
|
|
32
|
+
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
const { dir, name } = (0, import_path.parse)(entrypoint);
|
|
36
|
+
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
};
|
|
41
|
+
function hasProp(obj, key) {
|
|
42
|
+
return Object.hasOwnProperty.call(obj, key);
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
shouldServe
|
|
47
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
|
|
22
|
+
BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(constants_exports);
|
|
25
|
+
const BUILDER_INSTALLER_STEP = "vc.builder.install";
|
|
26
|
+
const BUILDER_COMPILE_STEP = "vc.builder.build";
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
BUILDER_COMPILE_STEP,
|
|
30
|
+
BUILDER_INSTALLER_STEP
|
|
31
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var trace_exports = {};
|
|
20
|
+
__export(trace_exports, {
|
|
21
|
+
BUILDER_COMPILE_STEP: () => import_constants.BUILDER_COMPILE_STEP,
|
|
22
|
+
BUILDER_INSTALLER_STEP: () => import_constants.BUILDER_INSTALLER_STEP,
|
|
23
|
+
Span: () => import_trace.Span
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(trace_exports);
|
|
26
|
+
var import_trace = require("./trace");
|
|
27
|
+
var import_constants = require("./constants");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
BUILDER_COMPILE_STEP,
|
|
31
|
+
BUILDER_INSTALLER_STEP,
|
|
32
|
+
Span
|
|
33
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type SpanId = string;
|
|
2
|
+
export type TraceEvent = {
|
|
3
|
+
parentId?: SpanId;
|
|
4
|
+
name: string;
|
|
5
|
+
id: SpanId;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
duration: number;
|
|
8
|
+
tags: Record<string, string>;
|
|
9
|
+
startTime: number;
|
|
10
|
+
};
|
|
11
|
+
export type Reporter = {
|
|
12
|
+
report: (event: TraceEvent) => void;
|
|
13
|
+
};
|
|
14
|
+
interface Attributes {
|
|
15
|
+
[key: string]: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare class Span {
|
|
18
|
+
private name;
|
|
19
|
+
private id;
|
|
20
|
+
private parentId?;
|
|
21
|
+
private attrs;
|
|
22
|
+
private status;
|
|
23
|
+
private _start;
|
|
24
|
+
private now;
|
|
25
|
+
private _reporter;
|
|
26
|
+
constructor({ name, parentId, attrs, reporter, }: {
|
|
27
|
+
name: string;
|
|
28
|
+
parentId?: SpanId;
|
|
29
|
+
attrs?: Attributes;
|
|
30
|
+
reporter?: Reporter;
|
|
31
|
+
});
|
|
32
|
+
stop(): void;
|
|
33
|
+
setAttributes(attrs: Attributes): void;
|
|
34
|
+
child(name: string, attrs?: Attributes): Span;
|
|
35
|
+
trace<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var trace_exports = {};
|
|
20
|
+
__export(trace_exports, {
|
|
21
|
+
Span: () => Span
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(trace_exports);
|
|
24
|
+
var import_node_crypto = require("node:crypto");
|
|
25
|
+
const NUM_OF_MICROSEC_IN_NANOSEC = BigInt("1000");
|
|
26
|
+
function mapUndefinedAttributes(attrs) {
|
|
27
|
+
return Object.fromEntries(
|
|
28
|
+
Object.entries(attrs ?? {}).filter(
|
|
29
|
+
(attr) => !!attr[1]
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
class Span {
|
|
34
|
+
constructor({
|
|
35
|
+
name,
|
|
36
|
+
parentId,
|
|
37
|
+
attrs,
|
|
38
|
+
reporter
|
|
39
|
+
}) {
|
|
40
|
+
this.name = name;
|
|
41
|
+
this.parentId = parentId;
|
|
42
|
+
this.attrs = mapUndefinedAttributes(attrs);
|
|
43
|
+
this.status = "started";
|
|
44
|
+
this.id = (0, import_node_crypto.randomUUID)();
|
|
45
|
+
this._reporter = reporter;
|
|
46
|
+
this.now = Date.now();
|
|
47
|
+
this._start = process.hrtime.bigint();
|
|
48
|
+
}
|
|
49
|
+
stop() {
|
|
50
|
+
if (this.status === "stopped") {
|
|
51
|
+
throw new Error(`Cannot stop a span which is already stopped`);
|
|
52
|
+
}
|
|
53
|
+
this.status = "stopped";
|
|
54
|
+
const end = process.hrtime.bigint();
|
|
55
|
+
const duration = Number((end - this._start) / NUM_OF_MICROSEC_IN_NANOSEC);
|
|
56
|
+
const timestamp = Number(this._start / NUM_OF_MICROSEC_IN_NANOSEC);
|
|
57
|
+
const traceEvent = {
|
|
58
|
+
name: this.name,
|
|
59
|
+
duration,
|
|
60
|
+
timestamp,
|
|
61
|
+
id: this.id,
|
|
62
|
+
parentId: this.parentId,
|
|
63
|
+
tags: this.attrs,
|
|
64
|
+
startTime: this.now
|
|
65
|
+
};
|
|
66
|
+
if (this._reporter) {
|
|
67
|
+
this._reporter.report(traceEvent);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
setAttributes(attrs) {
|
|
71
|
+
Object.assign(this.attrs, mapUndefinedAttributes(attrs));
|
|
72
|
+
}
|
|
73
|
+
child(name, attrs) {
|
|
74
|
+
return new Span({
|
|
75
|
+
name,
|
|
76
|
+
parentId: this.id,
|
|
77
|
+
attrs,
|
|
78
|
+
reporter: this._reporter
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async trace(fn) {
|
|
82
|
+
try {
|
|
83
|
+
return await fn(this);
|
|
84
|
+
} finally {
|
|
85
|
+
this.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
Span
|
|
92
|
+
});
|