@sylphx/sdk 0.19.3 → 0.21.0
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/README.md +47 -3
- package/dist/index.d.ts +843 -23
- package/dist/index.mjs +766 -15
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs +31 -25
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +32 -2
- package/dist/react/index.mjs +92 -9
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +36 -7
- package/dist/server/index.mjs +31 -29
- package/dist/server/index.mjs.map +1 -1
- package/dist/tasks.d.ts +1463 -0
- package/dist/tasks.mjs +1907 -0
- package/dist/tasks.mjs.map +1 -0
- package/package.json +10 -4
package/dist/nextjs/index.mjs
CHANGED
|
@@ -1610,7 +1610,14 @@ function getNamespace(secretKey) {
|
|
|
1610
1610
|
// src/nextjs/server.ts
|
|
1611
1611
|
import { cache as cache2 } from "react";
|
|
1612
1612
|
|
|
1613
|
-
//
|
|
1613
|
+
// src/server/index.ts
|
|
1614
|
+
import {
|
|
1615
|
+
isPlatformProjectIdentity,
|
|
1616
|
+
LEGACY_PLATFORM_PROJECT_ID,
|
|
1617
|
+
PLATFORM_CONSOLE_SLUG
|
|
1618
|
+
} from "@sylphx/contract";
|
|
1619
|
+
|
|
1620
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
1614
1621
|
var encoder = new TextEncoder();
|
|
1615
1622
|
var decoder = new TextDecoder();
|
|
1616
1623
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -1636,7 +1643,7 @@ function encode(string) {
|
|
|
1636
1643
|
return bytes;
|
|
1637
1644
|
}
|
|
1638
1645
|
|
|
1639
|
-
//
|
|
1646
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/base64.js
|
|
1640
1647
|
function decodeBase64(encoded) {
|
|
1641
1648
|
if (Uint8Array.fromBase64) {
|
|
1642
1649
|
return Uint8Array.fromBase64(encoded);
|
|
@@ -1649,7 +1656,7 @@ function decodeBase64(encoded) {
|
|
|
1649
1656
|
return bytes;
|
|
1650
1657
|
}
|
|
1651
1658
|
|
|
1652
|
-
//
|
|
1659
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/util/base64url.js
|
|
1653
1660
|
function decode(input) {
|
|
1654
1661
|
if (Uint8Array.fromBase64) {
|
|
1655
1662
|
return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), {
|
|
@@ -1668,7 +1675,7 @@ function decode(input) {
|
|
|
1668
1675
|
}
|
|
1669
1676
|
}
|
|
1670
1677
|
|
|
1671
|
-
//
|
|
1678
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/util/errors.js
|
|
1672
1679
|
var JOSEError = class extends Error {
|
|
1673
1680
|
static code = "ERR_JOSE_GENERIC";
|
|
1674
1681
|
code = "ERR_JOSE_GENERIC";
|
|
@@ -1728,7 +1735,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
1728
1735
|
}
|
|
1729
1736
|
};
|
|
1730
1737
|
|
|
1731
|
-
//
|
|
1738
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
1732
1739
|
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
1733
1740
|
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
1734
1741
|
function getHashLength(hash) {
|
|
@@ -1816,7 +1823,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
1816
1823
|
checkUsage(key, usage);
|
|
1817
1824
|
}
|
|
1818
1825
|
|
|
1819
|
-
//
|
|
1826
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
1820
1827
|
function message(msg, actual, ...types) {
|
|
1821
1828
|
types = types.filter(Boolean);
|
|
1822
1829
|
if (types.length > 2) {
|
|
@@ -1841,7 +1848,7 @@ function message(msg, actual, ...types) {
|
|
|
1841
1848
|
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
1842
1849
|
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
1843
1850
|
|
|
1844
|
-
//
|
|
1851
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
1845
1852
|
var isCryptoKey = (key) => {
|
|
1846
1853
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
1847
1854
|
return true;
|
|
@@ -1854,7 +1861,7 @@ var isCryptoKey = (key) => {
|
|
|
1854
1861
|
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
1855
1862
|
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
1856
1863
|
|
|
1857
|
-
//
|
|
1864
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
1858
1865
|
function isDisjoint(...headers) {
|
|
1859
1866
|
const sources = headers.filter(Boolean);
|
|
1860
1867
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -1877,7 +1884,7 @@ function isDisjoint(...headers) {
|
|
|
1877
1884
|
return true;
|
|
1878
1885
|
}
|
|
1879
1886
|
|
|
1880
|
-
//
|
|
1887
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_object.js
|
|
1881
1888
|
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
1882
1889
|
function isObject(input) {
|
|
1883
1890
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
@@ -1893,7 +1900,7 @@ function isObject(input) {
|
|
|
1893
1900
|
return Object.getPrototypeOf(input) === proto;
|
|
1894
1901
|
}
|
|
1895
1902
|
|
|
1896
|
-
//
|
|
1903
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
1897
1904
|
function checkKeyLength(alg, key) {
|
|
1898
1905
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
1899
1906
|
const { modulusLength } = key.algorithm;
|
|
@@ -1903,7 +1910,7 @@ function checkKeyLength(alg, key) {
|
|
|
1903
1910
|
}
|
|
1904
1911
|
}
|
|
1905
1912
|
|
|
1906
|
-
//
|
|
1913
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
1907
1914
|
function subtleMapping(jwk) {
|
|
1908
1915
|
let algorithm;
|
|
1909
1916
|
let keyUsages;
|
|
@@ -2013,7 +2020,7 @@ async function jwkToKey(jwk) {
|
|
|
2013
2020
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
2014
2021
|
}
|
|
2015
2022
|
|
|
2016
|
-
//
|
|
2023
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/key/import.js
|
|
2017
2024
|
async function importJWK(jwk, alg, options) {
|
|
2018
2025
|
if (!isObject(jwk)) {
|
|
2019
2026
|
throw new TypeError("JWK must be an object");
|
|
@@ -2049,7 +2056,7 @@ async function importJWK(jwk, alg, options) {
|
|
|
2049
2056
|
}
|
|
2050
2057
|
}
|
|
2051
2058
|
|
|
2052
|
-
//
|
|
2059
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
2053
2060
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
2054
2061
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
2055
2062
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
@@ -2080,7 +2087,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
2080
2087
|
return new Set(protectedHeader.crit);
|
|
2081
2088
|
}
|
|
2082
2089
|
|
|
2083
|
-
//
|
|
2090
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
2084
2091
|
function validateAlgorithms(option, algorithms) {
|
|
2085
2092
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
2086
2093
|
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
@@ -2091,13 +2098,13 @@ function validateAlgorithms(option, algorithms) {
|
|
|
2091
2098
|
return new Set(algorithms);
|
|
2092
2099
|
}
|
|
2093
2100
|
|
|
2094
|
-
//
|
|
2101
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
2095
2102
|
var isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
2096
2103
|
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
2097
2104
|
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
2098
2105
|
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
2099
2106
|
|
|
2100
|
-
//
|
|
2107
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
2101
2108
|
var cache;
|
|
2102
2109
|
var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
2103
2110
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -2268,7 +2275,7 @@ async function normalizeKey(key, alg) {
|
|
|
2268
2275
|
throw new Error("unreachable");
|
|
2269
2276
|
}
|
|
2270
2277
|
|
|
2271
|
-
//
|
|
2278
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
2272
2279
|
var tag = (key) => key?.[Symbol.toStringTag];
|
|
2273
2280
|
var jwkMatchesOp = (alg, key, usage) => {
|
|
2274
2281
|
if (key.use !== void 0) {
|
|
@@ -2388,7 +2395,7 @@ function checkKeyType(alg, key, usage) {
|
|
|
2388
2395
|
}
|
|
2389
2396
|
}
|
|
2390
2397
|
|
|
2391
|
-
//
|
|
2398
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
2392
2399
|
function subtleAlgorithm(alg, algorithm) {
|
|
2393
2400
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
2394
2401
|
switch (alg) {
|
|
@@ -2420,7 +2427,7 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
2420
2427
|
}
|
|
2421
2428
|
}
|
|
2422
2429
|
|
|
2423
|
-
//
|
|
2430
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
2424
2431
|
async function getSigKey(alg, key, usage) {
|
|
2425
2432
|
if (key instanceof Uint8Array) {
|
|
2426
2433
|
if (!alg.startsWith("HS")) {
|
|
@@ -2432,7 +2439,7 @@ async function getSigKey(alg, key, usage) {
|
|
|
2432
2439
|
return key;
|
|
2433
2440
|
}
|
|
2434
2441
|
|
|
2435
|
-
//
|
|
2442
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/verify.js
|
|
2436
2443
|
async function verify(alg, key, signature, data) {
|
|
2437
2444
|
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
2438
2445
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -2444,7 +2451,7 @@ async function verify(alg, key, signature, data) {
|
|
|
2444
2451
|
}
|
|
2445
2452
|
}
|
|
2446
2453
|
|
|
2447
|
-
//
|
|
2454
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
2448
2455
|
async function flattenedVerify(jws, key, options) {
|
|
2449
2456
|
if (!isObject(jws)) {
|
|
2450
2457
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
@@ -2546,7 +2553,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
2546
2553
|
return result;
|
|
2547
2554
|
}
|
|
2548
2555
|
|
|
2549
|
-
//
|
|
2556
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
2550
2557
|
async function compactVerify(jws, key, options) {
|
|
2551
2558
|
if (jws instanceof Uint8Array) {
|
|
2552
2559
|
jws = decoder.decode(jws);
|
|
@@ -2566,7 +2573,7 @@ async function compactVerify(jws, key, options) {
|
|
|
2566
2573
|
return result;
|
|
2567
2574
|
}
|
|
2568
2575
|
|
|
2569
|
-
//
|
|
2576
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
2570
2577
|
var epoch = (date) => Math.floor(date.getTime() / 1e3);
|
|
2571
2578
|
var minute = 60;
|
|
2572
2579
|
var hour = minute * 60;
|
|
@@ -2723,7 +2730,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
2723
2730
|
return payload;
|
|
2724
2731
|
}
|
|
2725
2732
|
|
|
2726
|
-
//
|
|
2733
|
+
// ../../../../.bun-cache/links/jose@6.1.3-bb9fbb1164201cee/node_modules/jose/dist/webapi/jwt/verify.js
|
|
2727
2734
|
async function jwtVerify(jwt, key, options) {
|
|
2728
2735
|
const verified = await compactVerify(jwt, key, options);
|
|
2729
2736
|
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|
|
@@ -2801,7 +2808,6 @@ function decodeUserId(prefixedId) {
|
|
|
2801
2808
|
}
|
|
2802
2809
|
|
|
2803
2810
|
// src/server/index.ts
|
|
2804
|
-
var PLATFORM_CONSOLE_SLUG = "keen-wave-x3m9p2";
|
|
2805
2811
|
var PLATFORM_TENANT_BAAS_URL = `https://${PLATFORM_CONSOLE_SLUG}.${DEFAULT_SDK_API_HOST}${SDK_API_PATH}`;
|
|
2806
2812
|
function isJwksResponse(data) {
|
|
2807
2813
|
return typeof data === "object" && data !== null && "keys" in data && Array.isArray(data.keys);
|