@anthropic-ai/foundry-sdk 0.2.2 → 0.2.4
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 +16 -0
- package/internal/decoders/jsonl.js.map +1 -1
- package/internal/decoders/jsonl.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/types.d.mts +6 -6
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -6
- package/internal/types.d.ts.map +1 -1
- package/internal/utils/abort.d.mts +13 -0
- package/internal/utils/abort.d.mts.map +1 -0
- package/internal/utils/abort.d.ts +13 -0
- package/internal/utils/abort.d.ts.map +1 -0
- package/internal/utils/abort.js +26 -0
- package/internal/utils/abort.js.map +1 -0
- package/internal/utils/abort.mjs +23 -0
- package/internal/utils/abort.mjs.map +1 -0
- package/internal/utils/async-queue.d.mts +31 -0
- package/internal/utils/async-queue.d.mts.map +1 -0
- package/internal/utils/async-queue.d.ts +31 -0
- package/internal/utils/async-queue.d.ts.map +1 -0
- package/internal/utils/async-queue.js +85 -0
- package/internal/utils/async-queue.js.map +1 -0
- package/internal/utils/async-queue.mjs +81 -0
- package/internal/utils/async-queue.mjs.map +1 -0
- package/internal/utils/backoff.d.mts +23 -0
- package/internal/utils/backoff.d.mts.map +1 -0
- package/internal/utils/backoff.d.ts +23 -0
- package/internal/utils/backoff.d.ts.map +1 -0
- package/internal/utils/backoff.js +44 -0
- package/internal/utils/backoff.js.map +1 -0
- package/internal/utils/backoff.mjs +36 -0
- package/internal/utils/backoff.mjs.map +1 -0
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +3 -2
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +3 -2
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/promise.d.mts +11 -0
- package/internal/utils/promise.d.mts.map +1 -0
- package/internal/utils/promise.d.ts +11 -0
- package/internal/utils/promise.d.ts.map +1 -0
- package/internal/utils/promise.js +18 -0
- package/internal/utils/promise.js.map +1 -0
- package/internal/utils/promise.mjs +15 -0
- package/internal/utils/promise.mjs.map +1 -0
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +42 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +9 -1
- package/internal/utils/sleep.d.mts.map +1 -1
- package/internal/utils/sleep.d.ts +9 -1
- package/internal/utils/sleep.d.ts.map +1 -1
- package/internal/utils/sleep.js +23 -2
- package/internal/utils/sleep.js.map +1 -1
- package/internal/utils/sleep.mjs +23 -2
- package/internal/utils/sleep.mjs.map +1 -1
- package/internal/utils/time.d.mts +3 -0
- package/internal/utils/time.d.mts.map +1 -0
- package/internal/utils/time.d.ts +3 -0
- package/internal/utils/time.d.ts.map +1 -0
- package/internal/utils/time.js +8 -0
- package/internal/utils/time.js.map +1 -0
- package/internal/utils/time.mjs +5 -0
- package/internal/utils/time.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +1 -1
- package/src/internal/decoders/jsonl.ts +2 -2
- package/src/internal/parse.ts +6 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/abort.ts +21 -0
- package/src/internal/utils/async-queue.ts +66 -0
- package/src/internal/utils/backoff.ts +41 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/internal/utils/log.ts +2 -1
- package/src/internal/utils/promise.ts +18 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils/sleep.ts +25 -2
- package/src/internal/utils/time.ts +4 -0
- package/src/internal/utils.ts +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promiseWithResolvers = promiseWithResolvers;
|
|
4
|
+
/**
|
|
5
|
+
* A deferred: a `Promise` together with its `resolve` / `reject` functions.
|
|
6
|
+
* This is `Promise.withResolvers()`, which is not available in all supported
|
|
7
|
+
* runtimes.
|
|
8
|
+
*/
|
|
9
|
+
function promiseWithResolvers() {
|
|
10
|
+
let resolve;
|
|
11
|
+
let reject;
|
|
12
|
+
const promise = new Promise((res, rej) => {
|
|
13
|
+
resolve = res;
|
|
14
|
+
reject = rej;
|
|
15
|
+
});
|
|
16
|
+
return { promise, resolve, reject };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/internal/utils/promise.ts"],"names":[],"mappings":";;AAKA,oDAYC;AAjBD;;;;GAIG;AACH,SAAgB,oBAAoB;IAKlC,IAAI,OAA6C,CAAC;IAClD,IAAI,MAAmC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deferred: a `Promise` together with its `resolve` / `reject` functions.
|
|
3
|
+
* This is `Promise.withResolvers()`, which is not available in all supported
|
|
4
|
+
* runtimes.
|
|
5
|
+
*/
|
|
6
|
+
export function promiseWithResolvers() {
|
|
7
|
+
let resolve;
|
|
8
|
+
let reject;
|
|
9
|
+
const promise = new Promise((res, rej) => {
|
|
10
|
+
resolve = res;
|
|
11
|
+
reject = rej;
|
|
12
|
+
});
|
|
13
|
+
return { promise, resolve, reject };
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=promise.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.mjs","sourceRoot":"","sources":["../../src/internal/utils/promise.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAKlC,IAAI,OAA6C,CAAC;IAClD,IAAI,MAAmC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.mts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAErE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAErE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.stringifyQuery = stringifyQuery;
|
|
38
|
+
const qs = __importStar(require("../qs/stringify.js"));
|
|
39
|
+
function stringifyQuery(query) {
|
|
40
|
+
return qs.stringify(query, { arrayFormat: 'brackets' });
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAItF,wCAEC;AAJD,uDAAsC;AAEtC,SAAgB,cAAc,CAAC,KAAuC;IACpE,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import * as qs from "../qs/stringify.mjs";
|
|
3
|
+
export function stringifyQuery(query) {
|
|
4
|
+
return qs.stringify(query, { arrayFormat: 'brackets' });
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=query.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.mjs","sourceRoot":"","sources":["../../src/internal/utils/query.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,KAAK,EAAE;AAEd,MAAM,UAAU,cAAc,CAAC,KAAuC;IACpE,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Resolve after `ms`, or immediately when `signal` aborts.
|
|
3
|
+
*
|
|
4
|
+
* When a `signal` is passed the abort listener is always removed so repeated
|
|
5
|
+
* calls do not accumulate listeners on a long-lived signal. Resolves (rather
|
|
6
|
+
* than rejects) on abort — callers treat abort as "wake up early," not as a
|
|
7
|
+
* failure; callers that want to unwind should check the signal themselves.
|
|
8
|
+
*/
|
|
9
|
+
export declare const sleep: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
2
10
|
//# sourceMappingURL=sleep.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.d.mts","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sleep.d.mts","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,IAAI,CAiBjE,CAAC"}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Resolve after `ms`, or immediately when `signal` aborts.
|
|
3
|
+
*
|
|
4
|
+
* When a `signal` is passed the abort listener is always removed so repeated
|
|
5
|
+
* calls do not accumulate listeners on a long-lived signal. Resolves (rather
|
|
6
|
+
* than rejects) on abort — callers treat abort as "wake up early," not as a
|
|
7
|
+
* failure; callers that want to unwind should check the signal themselves.
|
|
8
|
+
*/
|
|
9
|
+
export declare const sleep: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
2
10
|
//# sourceMappingURL=sleep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,IAAI,CAiBjE,CAAC"}
|
package/internal/utils/sleep.js
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.sleep = void 0;
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Resolve after `ms`, or immediately when `signal` aborts.
|
|
6
|
+
*
|
|
7
|
+
* When a `signal` is passed the abort listener is always removed so repeated
|
|
8
|
+
* calls do not accumulate listeners on a long-lived signal. Resolves (rather
|
|
9
|
+
* than rejects) on abort — callers treat abort as "wake up early," not as a
|
|
10
|
+
* failure; callers that want to unwind should check the signal themselves.
|
|
11
|
+
*/
|
|
12
|
+
const sleep = (ms, signal) => new Promise((resolve) => {
|
|
13
|
+
if (signal?.aborted)
|
|
14
|
+
return resolve();
|
|
15
|
+
const onAbort = () => {
|
|
16
|
+
clearTimeout(timer);
|
|
17
|
+
resolve();
|
|
18
|
+
};
|
|
19
|
+
const timer = setTimeout(() => {
|
|
20
|
+
signal?.removeEventListener('abort', onAbort);
|
|
21
|
+
resolve();
|
|
22
|
+
}, ms);
|
|
23
|
+
// `{ once: true }` auto-removes the listener if abort fires first,
|
|
24
|
+
// so we only need an explicit remove on the timer-wins path above.
|
|
25
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
26
|
+
});
|
|
6
27
|
exports.sleep = sleep;
|
|
7
28
|
//# sourceMappingURL=sleep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACI,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,MAAoB,EAAiB,EAAE,CACvE,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;IAC5B,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,OAAO,EAAE,CAAC;IAEtC,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;QAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,mEAAmE;IACnE,mEAAmE;IACnE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAjBQ,QAAA,KAAK,SAiBb"}
|
package/internal/utils/sleep.mjs
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Resolve after `ms`, or immediately when `signal` aborts.
|
|
3
|
+
*
|
|
4
|
+
* When a `signal` is passed the abort listener is always removed so repeated
|
|
5
|
+
* calls do not accumulate listeners on a long-lived signal. Resolves (rather
|
|
6
|
+
* than rejects) on abort — callers treat abort as "wake up early," not as a
|
|
7
|
+
* failure; callers that want to unwind should check the signal themselves.
|
|
8
|
+
*/
|
|
9
|
+
export const sleep = (ms, signal) => new Promise((resolve) => {
|
|
10
|
+
if (signal?.aborted)
|
|
11
|
+
return resolve();
|
|
12
|
+
const onAbort = () => {
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
resolve();
|
|
15
|
+
};
|
|
16
|
+
const timer = setTimeout(() => {
|
|
17
|
+
signal?.removeEventListener('abort', onAbort);
|
|
18
|
+
resolve();
|
|
19
|
+
}, ms);
|
|
20
|
+
// `{ once: true }` auto-removes the listener if abort fires first,
|
|
21
|
+
// so we only need an explicit remove on the timer-wins path above.
|
|
22
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
23
|
+
});
|
|
3
24
|
//# sourceMappingURL=sleep.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.mjs","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sleep.mjs","sourceRoot":"","sources":["../../src/internal/utils/sleep.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,MAAoB,EAAiB,EAAE,CACvE,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;IAC5B,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,OAAO,EAAE,CAAC;IAEtC,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;QAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,mEAAmE;IACnE,mEAAmE;IACnE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.mts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nowAsSeconds = nowAsSeconds;
|
|
4
|
+
/** Current time as unix epoch seconds. */
|
|
5
|
+
function nowAsSeconds() {
|
|
6
|
+
return Math.floor(Date.now() / 1000);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":";;AACA,oCAEC;AAHD,0CAA0C;AAC1C,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.mjs","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
package/internal/utils.d.mts
CHANGED
package/internal/utils.d.ts
CHANGED
package/internal/utils.js
CHANGED
|
@@ -21,4 +21,5 @@ __exportStar(require("./utils/env.js"), exports);
|
|
|
21
21
|
__exportStar(require("./utils/log.js"), exports);
|
|
22
22
|
__exportStar(require("./utils/uuid.js"), exports);
|
|
23
23
|
__exportStar(require("./utils/sleep.js"), exports);
|
|
24
|
+
__exportStar(require("./utils/query.js"), exports);
|
|
24
25
|
//# sourceMappingURL=utils.js.map
|
package/internal/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/internal/utils.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;AAEtF,oDAA+B;AAC/B,oDAA+B;AAC/B,iDAA4B;AAC5B,iDAA4B;AAC5B,kDAA6B;AAC7B,mDAA8B"}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/internal/utils.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;AAEtF,oDAA+B;AAC/B,oDAA+B;AAC/B,iDAA4B;AAC5B,iDAA4B;AAC5B,kDAA6B;AAC7B,mDAA8B;AAC9B,mDAA8B"}
|
package/internal/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -16,12 +16,12 @@ export class JSONLDecoder<T> {
|
|
|
16
16
|
const lineDecoder = new LineDecoder();
|
|
17
17
|
for await (const chunk of this.iterator) {
|
|
18
18
|
for (const line of lineDecoder.decode(chunk)) {
|
|
19
|
-
yield JSON.parse(line);
|
|
19
|
+
yield JSON.parse(line) as T;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
for (const line of lineDecoder.flush()) {
|
|
24
|
-
yield JSON.parse(line);
|
|
24
|
+
yield JSON.parse(line) as T;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
package/src/internal/parse.ts
CHANGED
|
@@ -47,6 +47,12 @@ export async function defaultParseResponse<T>(
|
|
|
47
47
|
const mediaType = contentType?.split(';')[0]?.trim();
|
|
48
48
|
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
49
49
|
if (isJSON) {
|
|
50
|
+
const contentLength = response.headers.get('content-length');
|
|
51
|
+
if (contentLength === '0') {
|
|
52
|
+
// if there is no content we can't do anything
|
|
53
|
+
return undefined as T;
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
const json = await response.json();
|
|
51
57
|
return addRequestID(json as T, response);
|
|
52
58
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
10
|
+
|
|
11
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Format } from './types';
|
|
2
|
+
|
|
3
|
+
export const default_format: Format = 'RFC3986';
|
|
4
|
+
export const default_formatter = (v: PropertyKey) => String(v);
|
|
5
|
+
export const formatters: Record<Format, (str: PropertyKey) => string> = {
|
|
6
|
+
RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'),
|
|
7
|
+
RFC3986: default_formatter,
|
|
8
|
+
};
|
|
9
|
+
export const RFC1738 = 'RFC1738';
|
|
10
|
+
export const RFC3986 = 'RFC3986';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default_format, formatters, RFC1738, RFC3986 } from './formats';
|
|
2
|
+
|
|
3
|
+
const formats = {
|
|
4
|
+
formatters,
|
|
5
|
+
RFC1738,
|
|
6
|
+
RFC3986,
|
|
7
|
+
default: default_format,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { stringify } from './stringify';
|
|
11
|
+
export { formats };
|
|
12
|
+
|
|
13
|
+
export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from './types';
|