@greenlandai/sdk 0.5.15 → 0.5.16
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/CHANGELOG.md +9 -0
- package/dist/index.cjs +11 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/core/transport.js +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 0.5.16 (2026-10-03)
|
|
2
|
+
- **A missing path id is refused before any request** (all 29 methods that put an id in the URL path: ENYAL lineage / thread /
|
|
3
|
+
knowledge nodes, GreenlandAI company / deposit / infrastructure / project, RAREEAI match actions, JoulePAI wallet / transfer /
|
|
4
|
+
funding). None / undefined, a non-string (an integer is allowed), an empty or blank string, or the text a missing value turns
|
|
5
|
+
into ("undefined", "null", "None", "NaN") raise `ValueError` (Python) / `TypeError` (JS). Until now the request went out with
|
|
6
|
+
"None" / "undefined" in the path.
|
|
7
|
+
- **Path ids are percent-encoded as one segment in Python too** (JS already encoded them). Until now the Python client sent an id
|
|
8
|
+
raw, so an id containing "/", "?" or "#" reached a different route.
|
|
9
|
+
|
|
1
10
|
## 0.5.15 (2026-10-01)
|
|
2
11
|
- **GreenlandAI's graph answers are about ONE entity** (GreenlandAI 8c0ec77). `client.gldai.relationships()` takes `entityType`
|
|
3
12
|
("company" | "infrastructure" | "deposit" | "project") + `entityId` to pin the start node; `entity` resolves to the one entity
|
package/dist/index.cjs
CHANGED
|
@@ -229,6 +229,15 @@ var noopLogger = { debug() {
|
|
|
229
229
|
}, warn() {
|
|
230
230
|
}, error() {
|
|
231
231
|
} };
|
|
232
|
+
var _MISSING_ID_TEXT = /* @__PURE__ */ new Set(["", "undefined", "null", "none", "nan"]);
|
|
233
|
+
function _pathId(name, value) {
|
|
234
|
+
const ok = typeof value === "string" || typeof value === "number" && Number.isFinite(value);
|
|
235
|
+
if (!ok) {
|
|
236
|
+
throw new TypeError(`${name} must be a non-empty string id (got ${value === null ? "null" : Array.isArray(value) ? "array" : typeof value}); no request was sent`);
|
|
237
|
+
}
|
|
238
|
+
if (_MISSING_ID_TEXT.has(String(value).trim().toLowerCase())) throw new TypeError(`${name} is empty or missing; no request was sent`);
|
|
239
|
+
return encodeURIComponent(String(value));
|
|
240
|
+
}
|
|
232
241
|
var Transport = class {
|
|
233
242
|
constructor({
|
|
234
243
|
apiKey,
|
|
@@ -281,7 +290,7 @@ var Transport = class {
|
|
|
281
290
|
headers = d.headers;
|
|
282
291
|
if (d.tier === NOT_SUPPORTED) retry = false;
|
|
283
292
|
let path = pathTemplate;
|
|
284
|
-
for (const [k, v] of Object.entries(pathParams)) path = path.replace(`{${k}}`,
|
|
293
|
+
for (const [k, v] of Object.entries(pathParams)) path = path.replace(`{${k}}`, _pathId(k, v));
|
|
285
294
|
let url = `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
286
295
|
if (params) {
|
|
287
296
|
const qs = new URLSearchParams(
|
|
@@ -4928,7 +4937,7 @@ var RareeaiSubmodule = class _RareeaiSubmodule {
|
|
|
4928
4937
|
};
|
|
4929
4938
|
|
|
4930
4939
|
// index.js
|
|
4931
|
-
var VERSION = "0.5.
|
|
4940
|
+
var VERSION = "0.5.16";
|
|
4932
4941
|
var Client = class {
|
|
4933
4942
|
/**
|
|
4934
4943
|
* @param {object} opts
|
package/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export {
|
|
|
16
16
|
export { ENFORCED, NOT_SUPPORTED, SAFE, IDEMPOTENCY_MAP } from "./src/core/idempotency.js";
|
|
17
17
|
export * as crypto from "./src/core/crypto.js";
|
|
18
18
|
|
|
19
|
-
export const VERSION = "0.5.
|
|
19
|
+
export const VERSION = "0.5.16";
|
|
20
20
|
|
|
21
21
|
export class Client {
|
|
22
22
|
/**
|
package/package.json
CHANGED
package/src/core/transport.js
CHANGED
|
@@ -69,6 +69,21 @@ function isRetryable(err) {
|
|
|
69
69
|
|
|
70
70
|
const noopLogger = { debug() {}, info() {}, warn() {}, error() {} };
|
|
71
71
|
|
|
72
|
+
// A record id in a URL path (P-DAY.126, operator: "/lineage/undefined is our client letting a bad call through"). Every path id goes
|
|
73
|
+
// through here (29 call sites): a missing id is refused BEFORE any request — undefined, null, a non-string (a finite number is allowed),
|
|
74
|
+
// an empty or blank string, or the text a missing value turns into ('undefined', 'null', 'None', 'NaN'); a real id is sent as ONE
|
|
75
|
+
// percent-encoded path segment. The error names the parameter and the type only — never the value.
|
|
76
|
+
const _MISSING_ID_TEXT = new Set(["", "undefined", "null", "none", "nan"]);
|
|
77
|
+
|
|
78
|
+
function _pathId(name, value) {
|
|
79
|
+
const ok = typeof value === "string" || (typeof value === "number" && Number.isFinite(value));
|
|
80
|
+
if (!ok) {
|
|
81
|
+
throw new TypeError(`${name} must be a non-empty string id (got ${value === null ? "null" : Array.isArray(value) ? "array" : typeof value}); no request was sent`);
|
|
82
|
+
}
|
|
83
|
+
if (_MISSING_ID_TEXT.has(String(value).trim().toLowerCase())) throw new TypeError(`${name} is empty or missing; no request was sent`);
|
|
84
|
+
return encodeURIComponent(String(value));
|
|
85
|
+
}
|
|
86
|
+
|
|
72
87
|
export class Transport {
|
|
73
88
|
constructor({ apiKey, oauthToken, logger, onRetry, onTerminalFailure,
|
|
74
89
|
onAuthExpired, metrics, fetchImpl } = {}) {
|
|
@@ -115,7 +130,7 @@ export class Transport {
|
|
|
115
130
|
if (d.tier === NOT_SUPPORTED) retry = false; // §3.1 layered rule
|
|
116
131
|
|
|
117
132
|
let path = pathTemplate;
|
|
118
|
-
for (const [k, v] of Object.entries(pathParams)) path = path.replace(`{${k}}`,
|
|
133
|
+
for (const [k, v] of Object.entries(pathParams)) path = path.replace(`{${k}}`, _pathId(k, v));
|
|
119
134
|
let url = `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
120
135
|
if (params) {
|
|
121
136
|
const qs = new URLSearchParams(
|