@sylphx/sdk 0.27.0 → 0.28.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 -2
- package/dist/connect.d.ts +2838 -0
- package/dist/connect.mjs +220 -0
- package/dist/connect.mjs.map +1 -0
- package/dist/index.d.ts +24380 -2217
- package/dist/index.mjs +30821 -2778
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs +29 -26
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +38 -1140
- package/dist/react/index.mjs +959 -2632
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +21 -38
- package/dist/server/index.mjs +27 -27
- package/dist/server/index.mjs.map +1 -1
- package/dist/web-analytics.mjs +1 -1
- package/dist/web-analytics.mjs.map +1 -1
- package/package.json +11 -5
- package/dist/tasks.d.ts +0 -1463
- package/dist/tasks.mjs +0 -1907
- package/dist/tasks.mjs.map +0 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -685,32 +685,29 @@ declare function isDevelopmentRuntime(): boolean;
|
|
|
685
685
|
type OAuthProvider = OAuthProviderId | (string & {});
|
|
686
686
|
|
|
687
687
|
/**
|
|
688
|
-
* Functions Client —
|
|
688
|
+
* Functions Client — suite door client (honesty-first)
|
|
689
689
|
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
690
|
+
* **Market pack:** first-class forever (never delete). Suite doors are product-native
|
|
691
|
+
* (postgres catalog + edge invoke) under hard cutover.
|
|
692
|
+
* **Commercial OCI GA grade:** still `commercial_ga=false` until plane A dens-live.
|
|
693
|
+
* Do not market plane A commercial GA as shipped; do not treat dens-dark as success.
|
|
692
694
|
*
|
|
693
|
-
*
|
|
695
|
+
* Planes (do not conflate) — see
|
|
696
|
+
* `docs/migration/FUNCTIONS-OCI-COMMERCIAL-SSOT.md` and
|
|
697
|
+
* `docs/catalog/baas/functions.md`:
|
|
698
|
+
* - **A (commercial residual):** customer OCI image → project-isolated Knative Serving
|
|
699
|
+
* - **B:** product web Knative scaleToZero (not Functions BaaS)
|
|
700
|
+
* - **C:** historical monorepo dens hard-cut dark (retired as product terminal)
|
|
701
|
+
* - **D:** Edge Runtime invoke implementation (product path; not commercial OCI GA)
|
|
702
|
+
* - **E:** product-native postgres catalog + edge invoke (current suite doors)
|
|
694
703
|
*
|
|
695
|
-
*
|
|
696
|
-
* - Invoked via HTTP: GET/POST https://{project}.sylphx.app/functions/{name}
|
|
697
|
-
* - Can access all Sylphx BaaS services via the SDK inside the handler
|
|
698
|
-
* - Isolated per project — no shared state between projects
|
|
704
|
+
* ## Product API (hard cutover ON)
|
|
699
705
|
*
|
|
700
|
-
*
|
|
706
|
+
* Deploy/list/get/delete/logs/invoke are product doors. Commercial OCI GA remains
|
|
707
|
+
* residual grade only — not permission to delete the pack.
|
|
701
708
|
*
|
|
702
709
|
* ```typescript
|
|
703
|
-
* //
|
|
704
|
-
* import { createServerClient } from '@sylphx/sdk/server'
|
|
705
|
-
*
|
|
706
|
-
* export default async function handler(req: Request): Promise<Response> {
|
|
707
|
-
* const { name } = await req.json()
|
|
708
|
-
* return Response.json({ message: `Hello, ${name}!` })
|
|
709
|
-
* }
|
|
710
|
-
* ```
|
|
711
|
-
*
|
|
712
|
-
* ```typescript
|
|
713
|
-
* // Deploy programmatically from trusted server-side tooling
|
|
710
|
+
* // Deploy programmatically from trusted server-side tooling (dev residual)
|
|
714
711
|
* import { createConfig, FunctionsClient } from '@sylphx/sdk'
|
|
715
712
|
*
|
|
716
713
|
* const config = createConfig({ secretKey: createServerClient(process.env.SYLPHX_SECRET_URL!).secretKey! })
|
|
@@ -719,27 +716,13 @@ type OAuthProvider = OAuthProviderId | (string & {});
|
|
|
719
716
|
* name: 'hello-world',
|
|
720
717
|
* code: `export default async (req) => Response.json({ ok: true })`,
|
|
721
718
|
* })
|
|
722
|
-
*
|
|
723
|
-
* // Invoke the function
|
|
724
|
-
* const result = await FunctionsClient.invoke(config, 'hello-world', { name: 'world' })
|
|
725
719
|
* ```
|
|
726
720
|
*
|
|
727
|
-
* ##
|
|
728
|
-
*
|
|
729
|
-
* All Web Standard APIs are available inside function handlers:
|
|
730
|
-
* - `fetch()` — HTTP requests
|
|
731
|
-
* - `Request`, `Response`, `Headers`, `URL`
|
|
732
|
-
* - `crypto` — Web Crypto API
|
|
733
|
-
* - `TextEncoder`, `TextDecoder`
|
|
734
|
-
* - `Deno.env.get('KEY')` — access injected env vars
|
|
735
|
-
*
|
|
736
|
-
* ## Constraints
|
|
721
|
+
* ## Constraints (preview residual when enabled)
|
|
737
722
|
*
|
|
738
723
|
* - Memory: 150 MB default (max 512 MB)
|
|
739
724
|
* - Timeout: 30s default (max 120s)
|
|
740
|
-
* -
|
|
741
|
-
* - No raw socket access (`net` module unavailable)
|
|
742
|
-
* - npm packages via CDN URL: `import { z } from 'https://esm.sh/zod'`
|
|
725
|
+
* - Source-body deploy residual is not customer OCI commercial admission
|
|
743
726
|
*/
|
|
744
727
|
|
|
745
728
|
type FunctionStatus = 'active' | 'deploying' | 'failed' | 'disabled';
|
|
@@ -1267,10 +1250,10 @@ interface KvClient {
|
|
|
1267
1250
|
* Set key expiration
|
|
1268
1251
|
*
|
|
1269
1252
|
* @param key - Key name
|
|
1270
|
-
* @param
|
|
1253
|
+
* @param ex - TTL in seconds
|
|
1271
1254
|
* @returns Whether the TTL was set (false if key does not exist)
|
|
1272
1255
|
*/
|
|
1273
|
-
expire(key: string,
|
|
1256
|
+
expire(key: string, ex: number): Promise<boolean>;
|
|
1274
1257
|
/**
|
|
1275
1258
|
* Check rate limit using sliding window algorithm
|
|
1276
1259
|
*
|
package/dist/server/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
PLATFORM_CONSOLE_SLUG
|
|
6
6
|
} from "@sylphx/contract";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
9
9
|
var encoder = new TextEncoder();
|
|
10
10
|
var decoder = new TextDecoder();
|
|
11
11
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -31,7 +31,7 @@ function encode(string) {
|
|
|
31
31
|
return bytes;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//
|
|
34
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/base64.js
|
|
35
35
|
function decodeBase64(encoded) {
|
|
36
36
|
if (Uint8Array.fromBase64) {
|
|
37
37
|
return Uint8Array.fromBase64(encoded);
|
|
@@ -44,7 +44,7 @@ function decodeBase64(encoded) {
|
|
|
44
44
|
return bytes;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//
|
|
47
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/util/base64url.js
|
|
48
48
|
function decode(input) {
|
|
49
49
|
if (Uint8Array.fromBase64) {
|
|
50
50
|
return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), {
|
|
@@ -63,7 +63,7 @@ function decode(input) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
//
|
|
66
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/util/errors.js
|
|
67
67
|
var JOSEError = class extends Error {
|
|
68
68
|
static code = "ERR_JOSE_GENERIC";
|
|
69
69
|
code = "ERR_JOSE_GENERIC";
|
|
@@ -123,7 +123,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
//
|
|
126
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
127
127
|
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
128
128
|
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
129
129
|
function getHashLength(hash) {
|
|
@@ -211,7 +211,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
211
211
|
checkUsage(key, usage);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
//
|
|
214
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
215
215
|
function message(msg, actual, ...types) {
|
|
216
216
|
types = types.filter(Boolean);
|
|
217
217
|
if (types.length > 2) {
|
|
@@ -236,7 +236,7 @@ function message(msg, actual, ...types) {
|
|
|
236
236
|
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
237
237
|
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
238
238
|
|
|
239
|
-
//
|
|
239
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
240
240
|
var isCryptoKey = (key) => {
|
|
241
241
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
242
242
|
return true;
|
|
@@ -249,7 +249,7 @@ var isCryptoKey = (key) => {
|
|
|
249
249
|
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
250
250
|
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
251
251
|
|
|
252
|
-
//
|
|
252
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
253
253
|
function isDisjoint(...headers) {
|
|
254
254
|
const sources = headers.filter(Boolean);
|
|
255
255
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -272,7 +272,7 @@ function isDisjoint(...headers) {
|
|
|
272
272
|
return true;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
//
|
|
275
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_object.js
|
|
276
276
|
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
277
277
|
function isObject(input) {
|
|
278
278
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
@@ -288,7 +288,7 @@ function isObject(input) {
|
|
|
288
288
|
return Object.getPrototypeOf(input) === proto;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
//
|
|
291
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
292
292
|
function checkKeyLength(alg, key) {
|
|
293
293
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
294
294
|
const { modulusLength } = key.algorithm;
|
|
@@ -298,7 +298,7 @@ function checkKeyLength(alg, key) {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
//
|
|
301
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
302
302
|
function subtleMapping(jwk) {
|
|
303
303
|
let algorithm;
|
|
304
304
|
let keyUsages;
|
|
@@ -408,7 +408,7 @@ async function jwkToKey(jwk) {
|
|
|
408
408
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
//
|
|
411
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/key/import.js
|
|
412
412
|
async function importJWK(jwk, alg, options) {
|
|
413
413
|
if (!isObject(jwk)) {
|
|
414
414
|
throw new TypeError("JWK must be an object");
|
|
@@ -444,7 +444,7 @@ async function importJWK(jwk, alg, options) {
|
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
//
|
|
447
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
448
448
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
449
449
|
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
450
450
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
@@ -475,7 +475,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
475
475
|
return new Set(protectedHeader.crit);
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
//
|
|
478
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
479
479
|
function validateAlgorithms(option, algorithms) {
|
|
480
480
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
481
481
|
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
@@ -486,13 +486,13 @@ function validateAlgorithms(option, algorithms) {
|
|
|
486
486
|
return new Set(algorithms);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
//
|
|
489
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
490
490
|
var isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
491
491
|
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
492
492
|
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
493
493
|
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
494
494
|
|
|
495
|
-
//
|
|
495
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
496
496
|
var cache;
|
|
497
497
|
var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
498
498
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -663,7 +663,7 @@ async function normalizeKey(key, alg) {
|
|
|
663
663
|
throw new Error("unreachable");
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
-
//
|
|
666
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
667
667
|
var tag = (key) => key?.[Symbol.toStringTag];
|
|
668
668
|
var jwkMatchesOp = (alg, key, usage) => {
|
|
669
669
|
if (key.use !== void 0) {
|
|
@@ -783,7 +783,7 @@ function checkKeyType(alg, key, usage) {
|
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
|
|
786
|
-
//
|
|
786
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
787
787
|
function subtleAlgorithm(alg, algorithm) {
|
|
788
788
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
789
789
|
switch (alg) {
|
|
@@ -815,7 +815,7 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
|
|
818
|
-
//
|
|
818
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
819
819
|
async function getSigKey(alg, key, usage) {
|
|
820
820
|
if (key instanceof Uint8Array) {
|
|
821
821
|
if (!alg.startsWith("HS")) {
|
|
@@ -827,7 +827,7 @@ async function getSigKey(alg, key, usage) {
|
|
|
827
827
|
return key;
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
-
//
|
|
830
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/verify.js
|
|
831
831
|
async function verify(alg, key, signature, data) {
|
|
832
832
|
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
833
833
|
checkKeyLength(alg, cryptoKey);
|
|
@@ -839,7 +839,7 @@ async function verify(alg, key, signature, data) {
|
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
//
|
|
842
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
843
843
|
async function flattenedVerify(jws, key, options) {
|
|
844
844
|
if (!isObject(jws)) {
|
|
845
845
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
@@ -941,7 +941,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
941
941
|
return result;
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
//
|
|
944
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
945
945
|
async function compactVerify(jws, key, options) {
|
|
946
946
|
if (jws instanceof Uint8Array) {
|
|
947
947
|
jws = decoder.decode(jws);
|
|
@@ -961,7 +961,7 @@ async function compactVerify(jws, key, options) {
|
|
|
961
961
|
return result;
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
-
//
|
|
964
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
965
965
|
var epoch = (date) => Math.floor(date.getTime() / 1e3);
|
|
966
966
|
var minute = 60;
|
|
967
967
|
var hour = minute * 60;
|
|
@@ -1118,7 +1118,7 @@ function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
|
1118
1118
|
return payload;
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
|
-
//
|
|
1121
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jwt/verify.js
|
|
1122
1122
|
async function jwtVerify(jwt, key, options) {
|
|
1123
1123
|
const verified = await compactVerify(jwt, key, options);
|
|
1124
1124
|
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|
|
@@ -1149,7 +1149,7 @@ function detectSdkPlatform() {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
var SDK_PLATFORM = detectSdkPlatform();
|
|
1151
1151
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
1152
|
-
var SESSION_TOKEN_LIFETIME_SECONDS =
|
|
1152
|
+
var SESSION_TOKEN_LIFETIME_SECONDS = 60 * 60;
|
|
1153
1153
|
var SESSION_TOKEN_LIFETIME_MS = SESSION_TOKEN_LIFETIME_SECONDS * 1e3;
|
|
1154
1154
|
var REFRESH_TOKEN_LIFETIME_SECONDS = 30 * 24 * 60 * 60;
|
|
1155
1155
|
var FLAGS_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
@@ -2794,10 +2794,10 @@ function createKv(options = {}) {
|
|
|
2794
2794
|
});
|
|
2795
2795
|
return result.value;
|
|
2796
2796
|
}
|
|
2797
|
-
async function expire(key,
|
|
2797
|
+
async function expire(key, ex) {
|
|
2798
2798
|
const result = await request("POST", "/expire", {
|
|
2799
2799
|
key,
|
|
2800
|
-
|
|
2800
|
+
ex
|
|
2801
2801
|
});
|
|
2802
2802
|
return result.success;
|
|
2803
2803
|
}
|