@alpic-ai/sdk 0.0.0-staging.ge30cbda → 0.0.0-staging.ge3be0ba
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/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/project/detect-runtime.js +21 -3
- package/dist/project/detect-runtime.js.map +1 -1
- package/dist/project/python-runtime.d.ts +1 -0
- package/dist/project/python-runtime.js +71 -0
- package/dist/project/python-runtime.js.map +1 -0
- package/dist/vendor/pipenet.js +590 -182
- package/dist/vendor/pipenet.js.map +4 -4
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type { AlpicApi } from "./api/client.js";
|
|
1
|
+
export type { AlpicApi, ApiAuth } from "./api/client.js";
|
|
2
|
+
export { createApiClient } from "./api/client.js";
|
|
2
3
|
export type { AuthEvents, Credentials, LoginOptions } from "./auth/index.js";
|
|
3
4
|
export { AlpicAuth } from "./auth/index.js";
|
|
4
5
|
export { getOAuthClient } from "./auth/oauth-client.js";
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { detectPythonRuntimeFromRequirement } from "./python-runtime.js";
|
|
2
3
|
export function detectRuntime() {
|
|
3
4
|
const has = (file) => existsSync(file);
|
|
4
5
|
const read = (file) => {
|
|
@@ -10,15 +11,32 @@ export function detectRuntime() {
|
|
|
10
11
|
}
|
|
11
12
|
};
|
|
12
13
|
if (has("pyproject.toml") || has("requirements.txt") || has("setup.py") || has(".python-version")) {
|
|
14
|
+
const version = has(".python-version")
|
|
15
|
+
? read(".python-version")
|
|
16
|
+
.trim()
|
|
17
|
+
.match(/^3\.(\d+)/)?.[1]
|
|
18
|
+
: undefined;
|
|
19
|
+
if (version) {
|
|
20
|
+
return Number(version) >= 15 ? "python3.15" : "python3.13";
|
|
21
|
+
}
|
|
22
|
+
const requiresPython = has("pyproject.toml")
|
|
23
|
+
? read("pyproject.toml").match(/requires-python\s*=\s*["']([^"']+)["']/)?.[1]
|
|
24
|
+
: undefined;
|
|
25
|
+
if (requiresPython) {
|
|
26
|
+
const runtime = detectPythonRuntimeFromRequirement(requiresPython);
|
|
27
|
+
if (runtime !== undefined) {
|
|
28
|
+
return runtime;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
13
31
|
return "python3.13";
|
|
14
32
|
}
|
|
15
33
|
if (has("package.json")) {
|
|
16
34
|
const nvmrc = has(".nvmrc") ? (read(".nvmrc").trim().split(/\s/)[0] ?? "") : "";
|
|
17
35
|
const major = nvmrc.replace(/^v/i, "").match(/^(\d+)/)?.[1];
|
|
18
|
-
if (major === "22") {
|
|
19
|
-
return
|
|
36
|
+
if (major === "22" || major === "24") {
|
|
37
|
+
return `node${major}`;
|
|
20
38
|
}
|
|
21
|
-
return "
|
|
39
|
+
return "node26";
|
|
22
40
|
}
|
|
23
41
|
return null;
|
|
24
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-runtime.js","sourceRoot":"","sources":["../../src/project/detect-runtime.ts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AAK,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACrC,OAAO,OAAO,KAAK,EAAE,CAAC;QACxB,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectPythonRuntimeFromRequirement(requiresPython: string): "python3.13" | "python3.14" | "python3.15" | null | undefined;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export function detectPythonRuntimeFromRequirement(requiresPython) {
|
|
2
|
+
const constraints = requiresPython.split(",").map((specifier) => {
|
|
3
|
+
const match = specifier
|
|
4
|
+
.trim()
|
|
5
|
+
.match(/^(>=|<=|~=|===|==|!=|>|<)?\s*(\d+)(?:\.(\d+))?(?:\.(\d+))?((?:a|b|rc)\d*(?:\.dev\d*)?|\.dev\d*)?(\.\*)?$/i);
|
|
6
|
+
if (!match ||
|
|
7
|
+
(match[6] && (match[5] || !["==", "!=", undefined].includes(match[1]))) ||
|
|
8
|
+
(match[1] === "~=" && !match[3])) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
operator: match[1] ?? "==",
|
|
13
|
+
major: Number(match[2]),
|
|
14
|
+
minor: Number(match[3] ?? 0),
|
|
15
|
+
patch: Number(match[4] ?? 0),
|
|
16
|
+
hasMinor: match[3] !== undefined,
|
|
17
|
+
hasPatch: match[4] !== undefined,
|
|
18
|
+
prerelease: match[5] !== undefined,
|
|
19
|
+
wildcard: match[6] !== undefined,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
if (constraints.some((constraint) => constraint === null)) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const parsed = constraints.filter((constraint) => constraint !== null);
|
|
26
|
+
const lowerBounds = parsed
|
|
27
|
+
.filter(({ operator, major }) => major === 3 && !["<", "<=", "!="].includes(operator))
|
|
28
|
+
.map(({ minor }) => minor);
|
|
29
|
+
const preferredMinor = Math.max(...(lowerBounds.length ? lowerBounds : [14]));
|
|
30
|
+
const supportedRuntimes = ["python3.13", "python3.14", "python3.15"].map((runtime) => ({
|
|
31
|
+
runtime,
|
|
32
|
+
minor: Number(runtime.split(".")[1]),
|
|
33
|
+
}));
|
|
34
|
+
const candidates = [
|
|
35
|
+
...supportedRuntimes.filter(({ minor }) => minor === preferredMinor),
|
|
36
|
+
...supportedRuntimes.filter(({ minor }) => minor !== preferredMinor),
|
|
37
|
+
];
|
|
38
|
+
const patches = [0, ...parsed.flatMap(({ patch }) => [patch, patch + 1])];
|
|
39
|
+
const runtime = candidates.find(({ minor }) => patches.some((patch) => parsed.every((constraint) => {
|
|
40
|
+
const comparison = 3 - constraint.major ||
|
|
41
|
+
minor - constraint.minor ||
|
|
42
|
+
patch - constraint.patch ||
|
|
43
|
+
(constraint.prerelease ? 1 : 0);
|
|
44
|
+
const matches = constraint.wildcard
|
|
45
|
+
? constraint.major === 3 &&
|
|
46
|
+
(!constraint.hasMinor || minor === constraint.minor) &&
|
|
47
|
+
(!constraint.hasPatch || patch === constraint.patch)
|
|
48
|
+
: comparison === 0;
|
|
49
|
+
switch (constraint.operator) {
|
|
50
|
+
case "==":
|
|
51
|
+
case "===":
|
|
52
|
+
return matches;
|
|
53
|
+
case "!=":
|
|
54
|
+
return !matches;
|
|
55
|
+
case ">=":
|
|
56
|
+
return comparison >= 0;
|
|
57
|
+
case ">":
|
|
58
|
+
return comparison > 0;
|
|
59
|
+
case "<=":
|
|
60
|
+
return comparison <= 0;
|
|
61
|
+
case "<":
|
|
62
|
+
return comparison < 0;
|
|
63
|
+
case "~=":
|
|
64
|
+
return comparison >= 0 && constraint.major === 3 && (!constraint.hasPatch || minor === constraint.minor);
|
|
65
|
+
default:
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
})));
|
|
69
|
+
return runtime?.runtime ?? null;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=python-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-runtime.js","sourceRoot":"","sources":["../../src/project/python-runtime.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kCAAkC,CAAC,cAAsB;IACvE,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,SAAS;aACpB,IAAI,EAAE;aACN,KAAK,CACJ,2GAA2G,CAC5G,CAAC;QACJ,IACE,CAAC,KAAK;YACN,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAChC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI;YAC1B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC5B,KAA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