@opendatalabs/vana-sdk 4.4.0 → 4.5.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 +176 -0
- package/dist/connect/account-origin.cjs +72 -0
- package/dist/connect/account-origin.cjs.map +1 -0
- package/dist/connect/account-origin.d.ts +92 -0
- package/dist/connect/account-origin.js +47 -0
- package/dist/connect/account-origin.js.map +1 -0
- package/dist/connect/account-origin.test.d.ts +1 -0
- package/dist/connect/chrome.cjs +284 -0
- package/dist/connect/chrome.cjs.map +1 -0
- package/dist/connect/chrome.d.ts +42 -0
- package/dist/connect/chrome.js +256 -0
- package/dist/connect/chrome.js.map +1 -0
- package/dist/connect/http-transports.cjs +100 -0
- package/dist/connect/http-transports.cjs.map +1 -0
- package/dist/connect/http-transports.d.ts +77 -0
- package/dist/connect/http-transports.js +75 -0
- package/dist/connect/http-transports.js.map +1 -0
- package/dist/connect/http-transports.test.d.ts +1 -0
- package/dist/connect/launcher.cjs +232 -0
- package/dist/connect/launcher.cjs.map +1 -0
- package/dist/connect/launcher.d.ts +129 -0
- package/dist/connect/launcher.js +220 -0
- package/dist/connect/launcher.js.map +1 -0
- package/dist/connect/launcher.test.d.ts +1 -0
- package/dist/connect/protocol.cjs +259 -0
- package/dist/connect/protocol.cjs.map +1 -0
- package/dist/connect/protocol.d.ts +331 -0
- package/dist/connect/protocol.js +215 -0
- package/dist/connect/protocol.js.map +1 -0
- package/dist/connect/protocol.test.d.ts +1 -0
- package/dist/connect.cjs +55 -0
- package/dist/connect.cjs.map +1 -0
- package/dist/connect.d.ts +35 -0
- package/dist/connect.js +34 -0
- package/dist/connect.js.map +1 -0
- package/dist/direct/connect-flow-sheet.test.d.ts +1 -0
- package/dist/direct/connect-flow.cjs +211 -1
- package/dist/direct/connect-flow.cjs.map +1 -1
- package/dist/direct/connect-flow.d.ts +75 -0
- package/dist/direct/connect-flow.js +213 -1
- package/dist/direct/connect-flow.js.map +1 -1
- package/dist/direct/connect-handler.cjs +493 -0
- package/dist/direct/connect-handler.cjs.map +1 -0
- package/dist/direct/connect-handler.d.ts +246 -0
- package/dist/direct/connect-handler.js +476 -0
- package/dist/direct/connect-handler.js.map +1 -0
- package/dist/direct/connect-handler.test.d.ts +1 -0
- package/dist/direct/controller.cjs +86 -17
- package/dist/direct/controller.cjs.map +1 -1
- package/dist/direct/controller.d.ts +101 -6
- package/dist/direct/controller.js +86 -16
- package/dist/direct/controller.js.map +1 -1
- package/dist/direct/endpoints.cjs +5 -2
- package/dist/direct/endpoints.cjs.map +1 -1
- package/dist/direct/endpoints.js +5 -2
- package/dist/direct/endpoints.js.map +1 -1
- package/dist/direct/request-authorization.cjs +65 -0
- package/dist/direct/request-authorization.cjs.map +1 -0
- package/dist/direct/request-authorization.d.ts +65 -0
- package/dist/direct/request-authorization.js +39 -0
- package/dist/direct/request-authorization.js.map +1 -0
- package/dist/direct/request-authorization.test.d.ts +1 -0
- package/dist/direct/types.cjs.map +1 -1
- package/dist/direct/types.d.ts +6 -0
- package/dist/direct/types.js.map +1 -1
- package/dist/direct/use-direct-vana-connect.cjs +18 -1
- package/dist/direct/use-direct-vana-connect.cjs.map +1 -1
- package/dist/direct/use-direct-vana-connect.js +18 -1
- package/dist/direct/use-direct-vana-connect.js.map +1 -1
- package/dist/direct/use-vana-connect.cjs +84 -0
- package/dist/direct/use-vana-connect.cjs.map +1 -0
- package/dist/direct/use-vana-connect.d.ts +59 -0
- package/dist/direct/use-vana-connect.js +64 -0
- package/dist/direct/use-vana-connect.js.map +1 -0
- package/dist/direct/use-vana-connect.test.d.ts +1 -0
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +104 -0
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +112 -0
- package/dist/index.node.cjs.map +3 -3
- package/dist/index.node.d.ts +1 -0
- package/dist/index.node.js +104 -0
- package/dist/index.node.js.map +4 -4
- package/dist/protocol/fixtures/pdpp-scope-keys.json +133 -0
- package/dist/protocol/pdpp-scopes.cjs +134 -0
- package/dist/protocol/pdpp-scopes.cjs.map +1 -0
- package/dist/protocol/pdpp-scopes.d.ts +123 -0
- package/dist/protocol/pdpp-scopes.js +103 -0
- package/dist/protocol/pdpp-scopes.js.map +1 -0
- package/dist/protocol/pdpp-scopes.test.d.ts +1 -0
- package/dist/protocol/scopes.cjs +17 -0
- package/dist/protocol/scopes.cjs.map +1 -1
- package/dist/protocol/scopes.d.ts +1 -0
- package/dist/protocol/scopes.js +18 -0
- package/dist/protocol/scopes.js.map +1 -1
- package/dist/react.cjs +10 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +4 -1
- package/dist/react.js +11 -1
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +61 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.ts +16 -4
- package/dist/server.js +67 -3
- package/dist/server.js.map +1 -1
- package/package.json +11 -1
package/dist/index.node.cjs
CHANGED
|
@@ -1217,6 +1217,7 @@ __export(index_node_exports, {
|
|
|
1217
1217
|
GoogleDriveStorage: () => GoogleDriveStorage,
|
|
1218
1218
|
InMemoryTokenStore: () => InMemoryTokenStore,
|
|
1219
1219
|
IngestResponseSchema: () => IngestResponseSchema,
|
|
1220
|
+
InvalidPdppGrantError: () => InvalidPdppGrantError,
|
|
1220
1221
|
InvalidScopeEntryError: () => InvalidScopeEntryError,
|
|
1221
1222
|
InvalidSignatureError: () => import_errors16.InvalidSignatureError,
|
|
1222
1223
|
IpfsStorage: () => IpfsStorage,
|
|
@@ -1248,6 +1249,8 @@ __export(index_node_exports, {
|
|
|
1248
1249
|
NodeECIESProvider: () => NodeECIESUint8Provider,
|
|
1249
1250
|
NodePlatformAdapter: () => NodePlatformAdapter,
|
|
1250
1251
|
OAuthClient: () => OAuthClient,
|
|
1252
|
+
PDPP_SCOPE_NAMESPACE: () => PDPP_SCOPE_NAMESPACE,
|
|
1253
|
+
PDPP_SOURCE_ID_PREFIX: () => PDPP_SOURCE_ID_PREFIX,
|
|
1251
1254
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX: () => PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
1252
1255
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE: () => PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
1253
1256
|
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION: () => PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
@@ -1373,6 +1376,7 @@ __export(index_node_exports, {
|
|
|
1373
1376
|
getServiceEndpoints: () => getServiceEndpoints,
|
|
1374
1377
|
grantPermissions: () => grantPermissions,
|
|
1375
1378
|
grantRegistrationDomain: () => grantRegistrationDomain,
|
|
1379
|
+
grantRequestScopes: () => grantRequestScopes,
|
|
1376
1380
|
grantRevocationDomain: () => grantRevocationDomain,
|
|
1377
1381
|
hasAction: () => hasAction,
|
|
1378
1382
|
isDataPointId: () => isDataPointId,
|
|
@@ -1380,6 +1384,7 @@ __export(index_node_exports, {
|
|
|
1380
1384
|
isDataPortabilityGatewayConfig: () => isDataPortabilityGatewayConfig,
|
|
1381
1385
|
isDerivativeStatusSettled: () => isDerivativeStatusSettled,
|
|
1382
1386
|
isECIESEncrypted: () => isECIESEncrypted,
|
|
1387
|
+
isPdppScopeKey: () => isPdppScopeKey,
|
|
1383
1388
|
isPlatformSupported: () => isPlatformSupported,
|
|
1384
1389
|
isRedactedLineageNode: () => isRedactedLineageNode,
|
|
1385
1390
|
isTombstoneHashes: () => isTombstoneHashes,
|
|
@@ -1397,6 +1402,7 @@ __export(index_node_exports, {
|
|
|
1397
1402
|
openJobResultStream: () => openJobResultStream,
|
|
1398
1403
|
openWriteSession: () => openWriteSession,
|
|
1399
1404
|
parsePSError: () => parsePSError,
|
|
1405
|
+
parsePdppScopeKey: () => parsePdppScopeKey,
|
|
1400
1406
|
parsePersonalServerPaymentRequired: () => parsePersonalServerPaymentRequired,
|
|
1401
1407
|
parseScope: () => parseScope,
|
|
1402
1408
|
parseScopeEntry: () => parseScopeEntry,
|
|
@@ -1404,6 +1410,8 @@ __export(index_node_exports, {
|
|
|
1404
1410
|
parseWriteMetadataHeader: () => parseWriteMetadataHeader,
|
|
1405
1411
|
paymentReceiptFromHeader: () => paymentReceiptFromHeader,
|
|
1406
1412
|
paymentResponseMetadataFromHeader: () => paymentResponseMetadataFromHeader,
|
|
1413
|
+
pdppGrantsToScopes: () => pdppGrantsToScopes,
|
|
1414
|
+
pdppScopeKey: () => pdppScopeKey,
|
|
1407
1415
|
permissionsToScopes: () => permissionsToScopes,
|
|
1408
1416
|
personalServerDataReadPath: () => personalServerDataReadPath,
|
|
1409
1417
|
personalServerLineagePath: () => personalServerLineagePath,
|
|
@@ -35787,6 +35795,102 @@ async function readPersonalServerData(params) {
|
|
|
35787
35795
|
|
|
35788
35796
|
// src/protocol/scopes.ts
|
|
35789
35797
|
var import_zod3 = require("zod");
|
|
35798
|
+
|
|
35799
|
+
// src/protocol/pdpp-scopes.ts
|
|
35800
|
+
var PDPP_SCOPE_NAMESPACE = "pdpp";
|
|
35801
|
+
var PDPP_SOURCE_ID_PREFIX = "https://registry.pdpp.dev/sources/";
|
|
35802
|
+
var SEGMENT = "[a-z0-9][a-z0-9_]*";
|
|
35803
|
+
var SOURCE_ID_RE = new RegExp(
|
|
35804
|
+
`^${PDPP_SOURCE_ID_PREFIX.replace(/[.]/g, "\\.")}(${SEGMENT})$`
|
|
35805
|
+
);
|
|
35806
|
+
var STREAM_RE = new RegExp(`^${SEGMENT}$`);
|
|
35807
|
+
var KEY_RE = new RegExp(
|
|
35808
|
+
`^${PDPP_SCOPE_NAMESPACE}\\.(${SEGMENT})\\.(${SEGMENT})$`
|
|
35809
|
+
);
|
|
35810
|
+
var InvalidPdppGrantError = class extends Error {
|
|
35811
|
+
/** Which part was rejected. */
|
|
35812
|
+
field;
|
|
35813
|
+
/** The rejected value, verbatim. */
|
|
35814
|
+
value;
|
|
35815
|
+
constructor(field, value, reason) {
|
|
35816
|
+
super(
|
|
35817
|
+
`Invalid PDPP ${field}${typeof value === "string" ? ` ${JSON.stringify(value)}` : ""}: ${reason}`
|
|
35818
|
+
);
|
|
35819
|
+
this.name = "InvalidPdppGrantError";
|
|
35820
|
+
this.field = field;
|
|
35821
|
+
this.value = value;
|
|
35822
|
+
}
|
|
35823
|
+
};
|
|
35824
|
+
function sourceSegment(sourceId) {
|
|
35825
|
+
const raw = sourceId;
|
|
35826
|
+
const match = typeof raw === "string" ? SOURCE_ID_RE.exec(raw) : null;
|
|
35827
|
+
if (!match) {
|
|
35828
|
+
throw new InvalidPdppGrantError(
|
|
35829
|
+
"source_id",
|
|
35830
|
+
raw,
|
|
35831
|
+
`must be ${PDPP_SOURCE_ID_PREFIX}<source> where <source> is lowercase letters, digits and underscores, not starting with an underscore`
|
|
35832
|
+
);
|
|
35833
|
+
}
|
|
35834
|
+
return match[1];
|
|
35835
|
+
}
|
|
35836
|
+
function assertStream(stream) {
|
|
35837
|
+
const raw = stream;
|
|
35838
|
+
if (typeof raw !== "string" || !STREAM_RE.test(raw)) {
|
|
35839
|
+
throw new InvalidPdppGrantError(
|
|
35840
|
+
"stream",
|
|
35841
|
+
raw,
|
|
35842
|
+
"must be lowercase letters, digits and underscores, not starting with an underscore"
|
|
35843
|
+
);
|
|
35844
|
+
}
|
|
35845
|
+
}
|
|
35846
|
+
function pdppScopeKey(source_id, stream) {
|
|
35847
|
+
const source = sourceSegment(source_id);
|
|
35848
|
+
assertStream(stream);
|
|
35849
|
+
return `${PDPP_SCOPE_NAMESPACE}.${source}.${stream}`;
|
|
35850
|
+
}
|
|
35851
|
+
function parsePdppScopeKey(key) {
|
|
35852
|
+
const raw = key;
|
|
35853
|
+
const match = typeof raw === "string" ? KEY_RE.exec(raw) : null;
|
|
35854
|
+
if (!match) return null;
|
|
35855
|
+
return { source_id: `${PDPP_SOURCE_ID_PREFIX}${match[1]}`, stream: match[2] };
|
|
35856
|
+
}
|
|
35857
|
+
function isPdppScopeKey(key) {
|
|
35858
|
+
return parsePdppScopeKey(key) !== null;
|
|
35859
|
+
}
|
|
35860
|
+
function pdppGrantsToScopes(grants) {
|
|
35861
|
+
const raw = grants;
|
|
35862
|
+
if (!Array.isArray(raw)) {
|
|
35863
|
+
throw new InvalidPdppGrantError("grants", raw, "must be an array");
|
|
35864
|
+
}
|
|
35865
|
+
const keys = /* @__PURE__ */ new Set();
|
|
35866
|
+
for (const grant of raw) {
|
|
35867
|
+
if (grant === null || typeof grant !== "object") {
|
|
35868
|
+
throw new InvalidPdppGrantError("grant", grant, "must be an object");
|
|
35869
|
+
}
|
|
35870
|
+
const { source_id: sourceId, streams } = grant;
|
|
35871
|
+
if (!Array.isArray(streams) || streams.length === 0) {
|
|
35872
|
+
throw new InvalidPdppGrantError(
|
|
35873
|
+
"streams",
|
|
35874
|
+
streams,
|
|
35875
|
+
`must name at least one stream${typeof sourceId === "string" ? ` for ${sourceId}` : ""}`
|
|
35876
|
+
);
|
|
35877
|
+
}
|
|
35878
|
+
for (const stream of streams) {
|
|
35879
|
+
keys.add(pdppScopeKey(sourceId, stream));
|
|
35880
|
+
}
|
|
35881
|
+
}
|
|
35882
|
+
return [...keys];
|
|
35883
|
+
}
|
|
35884
|
+
function grantRequestScopes(input) {
|
|
35885
|
+
const legacy = [...input.scopes ?? []];
|
|
35886
|
+
const present = new Set(legacy);
|
|
35887
|
+
const derived = pdppGrantsToScopes(input.grants ?? []).filter(
|
|
35888
|
+
(key) => !present.has(key)
|
|
35889
|
+
);
|
|
35890
|
+
return [...legacy, ...derived];
|
|
35891
|
+
}
|
|
35892
|
+
|
|
35893
|
+
// src/protocol/scopes.ts
|
|
35790
35894
|
var SOURCE_RE = /^[a-z0-9][a-z0-9_]*$/;
|
|
35791
35895
|
var TAIL_SEGMENT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_]*$/;
|
|
35792
35896
|
var ScopeSchema = import_zod3.z.string().refine(
|
|
@@ -38261,6 +38365,7 @@ async function parsePSError(response) {
|
|
|
38261
38365
|
GoogleDriveStorage,
|
|
38262
38366
|
InMemoryTokenStore,
|
|
38263
38367
|
IngestResponseSchema,
|
|
38368
|
+
InvalidPdppGrantError,
|
|
38264
38369
|
InvalidScopeEntryError,
|
|
38265
38370
|
InvalidSignatureError,
|
|
38266
38371
|
IpfsStorage,
|
|
@@ -38292,6 +38397,8 @@ async function parsePSError(response) {
|
|
|
38292
38397
|
NodeECIESProvider,
|
|
38293
38398
|
NodePlatformAdapter,
|
|
38294
38399
|
OAuthClient,
|
|
38400
|
+
PDPP_SCOPE_NAMESPACE,
|
|
38401
|
+
PDPP_SOURCE_ID_PREFIX,
|
|
38295
38402
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
38296
38403
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
38297
38404
|
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
@@ -38417,6 +38524,7 @@ async function parsePSError(response) {
|
|
|
38417
38524
|
getServiceEndpoints,
|
|
38418
38525
|
grantPermissions,
|
|
38419
38526
|
grantRegistrationDomain,
|
|
38527
|
+
grantRequestScopes,
|
|
38420
38528
|
grantRevocationDomain,
|
|
38421
38529
|
hasAction,
|
|
38422
38530
|
isDataPointId,
|
|
@@ -38424,6 +38532,7 @@ async function parsePSError(response) {
|
|
|
38424
38532
|
isDataPortabilityGatewayConfig,
|
|
38425
38533
|
isDerivativeStatusSettled,
|
|
38426
38534
|
isECIESEncrypted,
|
|
38535
|
+
isPdppScopeKey,
|
|
38427
38536
|
isPlatformSupported,
|
|
38428
38537
|
isRedactedLineageNode,
|
|
38429
38538
|
isTombstoneHashes,
|
|
@@ -38441,6 +38550,7 @@ async function parsePSError(response) {
|
|
|
38441
38550
|
openJobResultStream,
|
|
38442
38551
|
openWriteSession,
|
|
38443
38552
|
parsePSError,
|
|
38553
|
+
parsePdppScopeKey,
|
|
38444
38554
|
parsePersonalServerPaymentRequired,
|
|
38445
38555
|
parseScope,
|
|
38446
38556
|
parseScopeEntry,
|
|
@@ -38448,6 +38558,8 @@ async function parsePSError(response) {
|
|
|
38448
38558
|
parseWriteMetadataHeader,
|
|
38449
38559
|
paymentReceiptFromHeader,
|
|
38450
38560
|
paymentResponseMetadataFromHeader,
|
|
38561
|
+
pdppGrantsToScopes,
|
|
38562
|
+
pdppScopeKey,
|
|
38451
38563
|
permissionsToScopes,
|
|
38452
38564
|
personalServerDataReadPath,
|
|
38453
38565
|
personalServerLineagePath,
|