@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.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { TOMBSTONE_DATA_HASH, TOMBSTONE_METADATA_HASH, TOMBSTONE_DATA_HASH_PREIM
|
|
|
53
53
|
export { personalServerDataReadPath, buildPersonalServerDataReadRequest, readPersonalServerData, type BuildPersonalServerDataReadRequestParams, type ReadPersonalServerDataParams, } from "./protocol/personal-server-data.js";
|
|
54
54
|
export { ScopeSchema, parseScope, scopeToPathSegments, scopeMatchesPattern, scopeCoveredByGrant, type Scope, type ParsedScope, } from "./protocol/scopes.js";
|
|
55
55
|
export { SCOPE_ACTIONS, InvalidScopeEntryError, parseScopeEntry, formatScopeEntry, grantPermissions, permissionsToScopes, tryGrantPermissions, hasAction, type ScopeAction, type ParsedScopeEntry, type GrantPermission, } from "./protocol/scope-actions.js";
|
|
56
|
+
export { PDPP_SCOPE_NAMESPACE, PDPP_SOURCE_ID_PREFIX, InvalidPdppGrantError, pdppScopeKey, parsePdppScopeKey, isPdppScopeKey, pdppGrantsToScopes, grantRequestScopes, type PdppGrant, type PdppScopeKeyParts, } from "./protocol/pdpp-scopes.js";
|
|
56
57
|
export { WRITE_SESSION_PATH, WRITE_SIGNATURE_HEADER, WRITE_METADATA_HEADER, WRITE_FILENAME_HEADER, WRITE_CONTENT_DISPOSITION_HEADER, WRITER_ATTRIBUTION_KEY, LINEAGE_KEY, LINEAGE_FIELD, MAX_LINEAGE_SOURCES, RESERVED_WRITE_KEYS, openWriteSession, writeData, writePersonalServerData, sessionCoversScope, binaryWriteSignedBytes, normalizeBinaryMimeType, parseWriteMetadataHeader, encodeWriteMetadataHeader, type WriteTransportRetryOptions, type WriteSession, type OpenWriteSessionParams, type WriteBinaryPayload, type LineageSource, type WriteJsonDataParams, type WriteBinaryDataParams, type WriteDataParams, type WriteDataResult, type WritePersonalServerDataParams, type WritePersonalServerDataResult, type BinaryWriteSignedBytesInput, } from "./protocol/personal-server-write.js";
|
|
57
58
|
export { resolveWriteSigner, type WriteSigner, type WriteSignerSource, type ViemWriteAccount, type ViemWriteWalletClient, type ResolveWriteSignerOptions, } from "./protocol/write-signer.js";
|
|
58
59
|
export { DERIVATIVE_QUESTIONS_PATH, MAX_QUESTION_SOURCE_SCOPES, MAX_QUESTION_CHARS, MAX_QUESTION_MODEL_CHARS, DEFAULT_QUESTION_TIMEOUT_MS, DEFAULT_QUESTION_POLL_INTERVAL_MS, QUESTION_STATUSES, DERIVATIVE_ERROR_CODES, DerivativeErrorCodeSchema, type DerivativeErrorCode, registerQuestion, getQuestion, listQuestions, recomputeQuestion, deleteQuestion, waitForQuestion, askPersonalServer, QuestionStatusSchema, QuestionRegisteredBySchema, DerivativeQuestionSchema, QuestionRecomputeResultSchema, QuestionDeleteResultSchema, type QuestionStatus, type QuestionRegisteredBy, type DerivativeQuestion, type QuestionRecomputeResult, type QuestionDeleteResult, type DerivativeQuestionAuthParams, type RegisterQuestionParams, type GetQuestionParams, type ListQuestionsParams, type RecomputeQuestionParams, type DeleteQuestionParams, type WaitForQuestionParams, type AskPersonalServerParams, type AskPersonalServerResult, } from "./protocol/derivative-questions.js";
|
package/dist/index.node.js
CHANGED
|
@@ -35551,6 +35551,102 @@ async function readPersonalServerData(params) {
|
|
|
35551
35551
|
|
|
35552
35552
|
// src/protocol/scopes.ts
|
|
35553
35553
|
import { z as z3 } from "zod";
|
|
35554
|
+
|
|
35555
|
+
// src/protocol/pdpp-scopes.ts
|
|
35556
|
+
var PDPP_SCOPE_NAMESPACE = "pdpp";
|
|
35557
|
+
var PDPP_SOURCE_ID_PREFIX = "https://registry.pdpp.dev/sources/";
|
|
35558
|
+
var SEGMENT = "[a-z0-9][a-z0-9_]*";
|
|
35559
|
+
var SOURCE_ID_RE = new RegExp(
|
|
35560
|
+
`^${PDPP_SOURCE_ID_PREFIX.replace(/[.]/g, "\\.")}(${SEGMENT})$`
|
|
35561
|
+
);
|
|
35562
|
+
var STREAM_RE = new RegExp(`^${SEGMENT}$`);
|
|
35563
|
+
var KEY_RE = new RegExp(
|
|
35564
|
+
`^${PDPP_SCOPE_NAMESPACE}\\.(${SEGMENT})\\.(${SEGMENT})$`
|
|
35565
|
+
);
|
|
35566
|
+
var InvalidPdppGrantError = class extends Error {
|
|
35567
|
+
/** Which part was rejected. */
|
|
35568
|
+
field;
|
|
35569
|
+
/** The rejected value, verbatim. */
|
|
35570
|
+
value;
|
|
35571
|
+
constructor(field, value, reason) {
|
|
35572
|
+
super(
|
|
35573
|
+
`Invalid PDPP ${field}${typeof value === "string" ? ` ${JSON.stringify(value)}` : ""}: ${reason}`
|
|
35574
|
+
);
|
|
35575
|
+
this.name = "InvalidPdppGrantError";
|
|
35576
|
+
this.field = field;
|
|
35577
|
+
this.value = value;
|
|
35578
|
+
}
|
|
35579
|
+
};
|
|
35580
|
+
function sourceSegment(sourceId) {
|
|
35581
|
+
const raw = sourceId;
|
|
35582
|
+
const match = typeof raw === "string" ? SOURCE_ID_RE.exec(raw) : null;
|
|
35583
|
+
if (!match) {
|
|
35584
|
+
throw new InvalidPdppGrantError(
|
|
35585
|
+
"source_id",
|
|
35586
|
+
raw,
|
|
35587
|
+
`must be ${PDPP_SOURCE_ID_PREFIX}<source> where <source> is lowercase letters, digits and underscores, not starting with an underscore`
|
|
35588
|
+
);
|
|
35589
|
+
}
|
|
35590
|
+
return match[1];
|
|
35591
|
+
}
|
|
35592
|
+
function assertStream(stream) {
|
|
35593
|
+
const raw = stream;
|
|
35594
|
+
if (typeof raw !== "string" || !STREAM_RE.test(raw)) {
|
|
35595
|
+
throw new InvalidPdppGrantError(
|
|
35596
|
+
"stream",
|
|
35597
|
+
raw,
|
|
35598
|
+
"must be lowercase letters, digits and underscores, not starting with an underscore"
|
|
35599
|
+
);
|
|
35600
|
+
}
|
|
35601
|
+
}
|
|
35602
|
+
function pdppScopeKey(source_id, stream) {
|
|
35603
|
+
const source = sourceSegment(source_id);
|
|
35604
|
+
assertStream(stream);
|
|
35605
|
+
return `${PDPP_SCOPE_NAMESPACE}.${source}.${stream}`;
|
|
35606
|
+
}
|
|
35607
|
+
function parsePdppScopeKey(key) {
|
|
35608
|
+
const raw = key;
|
|
35609
|
+
const match = typeof raw === "string" ? KEY_RE.exec(raw) : null;
|
|
35610
|
+
if (!match) return null;
|
|
35611
|
+
return { source_id: `${PDPP_SOURCE_ID_PREFIX}${match[1]}`, stream: match[2] };
|
|
35612
|
+
}
|
|
35613
|
+
function isPdppScopeKey(key) {
|
|
35614
|
+
return parsePdppScopeKey(key) !== null;
|
|
35615
|
+
}
|
|
35616
|
+
function pdppGrantsToScopes(grants) {
|
|
35617
|
+
const raw = grants;
|
|
35618
|
+
if (!Array.isArray(raw)) {
|
|
35619
|
+
throw new InvalidPdppGrantError("grants", raw, "must be an array");
|
|
35620
|
+
}
|
|
35621
|
+
const keys = /* @__PURE__ */ new Set();
|
|
35622
|
+
for (const grant of raw) {
|
|
35623
|
+
if (grant === null || typeof grant !== "object") {
|
|
35624
|
+
throw new InvalidPdppGrantError("grant", grant, "must be an object");
|
|
35625
|
+
}
|
|
35626
|
+
const { source_id: sourceId, streams } = grant;
|
|
35627
|
+
if (!Array.isArray(streams) || streams.length === 0) {
|
|
35628
|
+
throw new InvalidPdppGrantError(
|
|
35629
|
+
"streams",
|
|
35630
|
+
streams,
|
|
35631
|
+
`must name at least one stream${typeof sourceId === "string" ? ` for ${sourceId}` : ""}`
|
|
35632
|
+
);
|
|
35633
|
+
}
|
|
35634
|
+
for (const stream of streams) {
|
|
35635
|
+
keys.add(pdppScopeKey(sourceId, stream));
|
|
35636
|
+
}
|
|
35637
|
+
}
|
|
35638
|
+
return [...keys];
|
|
35639
|
+
}
|
|
35640
|
+
function grantRequestScopes(input) {
|
|
35641
|
+
const legacy = [...input.scopes ?? []];
|
|
35642
|
+
const present = new Set(legacy);
|
|
35643
|
+
const derived = pdppGrantsToScopes(input.grants ?? []).filter(
|
|
35644
|
+
(key) => !present.has(key)
|
|
35645
|
+
);
|
|
35646
|
+
return [...legacy, ...derived];
|
|
35647
|
+
}
|
|
35648
|
+
|
|
35649
|
+
// src/protocol/scopes.ts
|
|
35554
35650
|
var SOURCE_RE = /^[a-z0-9][a-z0-9_]*$/;
|
|
35555
35651
|
var TAIL_SEGMENT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_]*$/;
|
|
35556
35652
|
var ScopeSchema = z3.string().refine(
|
|
@@ -38060,6 +38156,7 @@ export {
|
|
|
38060
38156
|
GoogleDriveStorage,
|
|
38061
38157
|
InMemoryTokenStore,
|
|
38062
38158
|
IngestResponseSchema,
|
|
38159
|
+
InvalidPdppGrantError,
|
|
38063
38160
|
InvalidScopeEntryError,
|
|
38064
38161
|
InvalidSignatureError2 as InvalidSignatureError,
|
|
38065
38162
|
IpfsStorage,
|
|
@@ -38091,6 +38188,8 @@ export {
|
|
|
38091
38188
|
NodeECIESUint8Provider as NodeECIESProvider,
|
|
38092
38189
|
NodePlatformAdapter,
|
|
38093
38190
|
OAuthClient,
|
|
38191
|
+
PDPP_SCOPE_NAMESPACE,
|
|
38192
|
+
PDPP_SOURCE_ID_PREFIX,
|
|
38094
38193
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
38095
38194
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
38096
38195
|
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
@@ -38216,6 +38315,7 @@ export {
|
|
|
38216
38315
|
getServiceEndpoints,
|
|
38217
38316
|
grantPermissions,
|
|
38218
38317
|
grantRegistrationDomain,
|
|
38318
|
+
grantRequestScopes,
|
|
38219
38319
|
grantRevocationDomain,
|
|
38220
38320
|
hasAction,
|
|
38221
38321
|
isDataPointId,
|
|
@@ -38223,6 +38323,7 @@ export {
|
|
|
38223
38323
|
isDataPortabilityGatewayConfig,
|
|
38224
38324
|
isDerivativeStatusSettled,
|
|
38225
38325
|
isECIESEncrypted,
|
|
38326
|
+
isPdppScopeKey,
|
|
38226
38327
|
isPlatformSupported,
|
|
38227
38328
|
isRedactedLineageNode,
|
|
38228
38329
|
isTombstoneHashes,
|
|
@@ -38240,6 +38341,7 @@ export {
|
|
|
38240
38341
|
openJobResultStream,
|
|
38241
38342
|
openWriteSession,
|
|
38242
38343
|
parsePSError,
|
|
38344
|
+
parsePdppScopeKey,
|
|
38243
38345
|
parsePersonalServerPaymentRequired,
|
|
38244
38346
|
parseScope,
|
|
38245
38347
|
parseScopeEntry,
|
|
@@ -38247,6 +38349,8 @@ export {
|
|
|
38247
38349
|
parseWriteMetadataHeader,
|
|
38248
38350
|
paymentReceiptFromHeader,
|
|
38249
38351
|
paymentResponseMetadataFromHeader,
|
|
38352
|
+
pdppGrantsToScopes,
|
|
38353
|
+
pdppScopeKey,
|
|
38250
38354
|
permissionsToScopes,
|
|
38251
38355
|
personalServerDataReadPath,
|
|
38252
38356
|
personalServerLineagePath,
|