@learncard/network-brain-client 2.5.21 → 2.5.24
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 +23 -0
- package/dist/brain-client.cjs.development.js +182 -9
- package/dist/brain-client.cjs.development.js.map +2 -2
- package/dist/brain-client.cjs.production.min.js +13 -13
- package/dist/brain-client.cjs.production.min.js.map +3 -3
- package/dist/brain-client.esm.js +97 -9
- package/dist/brain-client.esm.js.map +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +27 -4
package/dist/brain-client.esm.js
CHANGED
|
@@ -14072,11 +14072,13 @@ var require_types_cjs_development = __commonJS2({
|
|
|
14072
14072
|
AppEventValidator: /* @__PURE__ */ __name2(() => AppEventValidator, "AppEventValidator"),
|
|
14073
14073
|
AppListingStatusValidator: /* @__PURE__ */ __name2(() => AppListingStatusValidator, "AppListingStatusValidator"),
|
|
14074
14074
|
AppStoreListingCreateValidator: /* @__PURE__ */ __name2(() => AppStoreListingCreateValidator, "AppStoreListingCreateValidator"),
|
|
14075
|
+
AppStoreListingSubmitterValidator: /* @__PURE__ */ __name2(() => AppStoreListingSubmitterValidator, "AppStoreListingSubmitterValidator"),
|
|
14075
14076
|
AppStoreListingUpdateValidator: /* @__PURE__ */ __name2(() => AppStoreListingUpdateValidator, "AppStoreListingUpdateValidator"),
|
|
14076
14077
|
AppStoreListingValidator: /* @__PURE__ */ __name2(() => AppStoreListingValidator, "AppStoreListingValidator"),
|
|
14077
14078
|
AuthGrantQueryValidator: /* @__PURE__ */ __name2(() => AuthGrantQueryValidator, "AuthGrantQueryValidator"),
|
|
14078
14079
|
AuthGrantStatusValidator: /* @__PURE__ */ __name2(() => AuthGrantStatusValidator, "AuthGrantStatusValidator"),
|
|
14079
14080
|
AuthGrantValidator: /* @__PURE__ */ __name2(() => AuthGrantValidator, "AuthGrantValidator"),
|
|
14081
|
+
AuthSessionError: /* @__PURE__ */ __name2(() => AuthSessionError, "AuthSessionError"),
|
|
14080
14082
|
AutoBoostConfigValidator: /* @__PURE__ */ __name2(() => AutoBoostConfigValidator, "AutoBoostConfigValidator"),
|
|
14081
14083
|
BoostPermissionsQueryValidator: /* @__PURE__ */ __name2(() => BoostPermissionsQueryValidator, "BoostPermissionsQueryValidator"),
|
|
14082
14084
|
BoostPermissionsValidator: /* @__PURE__ */ __name2(() => BoostPermissionsValidator, "BoostPermissionsValidator"),
|
|
@@ -14084,6 +14086,8 @@ var require_types_cjs_development = __commonJS2({
|
|
|
14084
14086
|
BoostRecipientValidator: /* @__PURE__ */ __name2(() => BoostRecipientValidator, "BoostRecipientValidator"),
|
|
14085
14087
|
BoostRecipientWithChildrenValidator: /* @__PURE__ */ __name2(() => BoostRecipientWithChildrenValidator, "BoostRecipientWithChildrenValidator"),
|
|
14086
14088
|
BoostValidator: /* @__PURE__ */ __name2(() => BoostValidator, "BoostValidator"),
|
|
14089
|
+
CheckCredentialEventValidator: /* @__PURE__ */ __name2(() => CheckCredentialEventValidator, "CheckCredentialEventValidator"),
|
|
14090
|
+
CheckIssuanceStatusEventValidator: /* @__PURE__ */ __name2(() => CheckIssuanceStatusEventValidator, "CheckIssuanceStatusEventValidator"),
|
|
14087
14091
|
ClaimHookQueryValidator: /* @__PURE__ */ __name2(() => ClaimHookQueryValidator, "ClaimHookQueryValidator"),
|
|
14088
14092
|
ClaimHookTypeValidator: /* @__PURE__ */ __name2(() => ClaimHookTypeValidator, "ClaimHookTypeValidator"),
|
|
14089
14093
|
ClaimHookValidator: /* @__PURE__ */ __name2(() => ClaimHookValidator, "ClaimHookValidator"),
|
|
@@ -14093,6 +14097,10 @@ var require_types_cjs_development = __commonJS2({
|
|
|
14093
14097
|
ConsentFlowContractDataValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractDataValidator, "ConsentFlowContractDataValidator"),
|
|
14094
14098
|
ConsentFlowContractDetailsValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractDetailsValidator, "ConsentFlowContractDetailsValidator"),
|
|
14095
14099
|
ConsentFlowContractQueryValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractQueryValidator, "ConsentFlowContractQueryValidator"),
|
|
14100
|
+
ConsentFlowContractRequestForProfileListValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractRequestForProfileListValidator, "ConsentFlowContractRequestForProfileListValidator"),
|
|
14101
|
+
ConsentFlowContractRequestForProfileValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractRequestForProfileValidator, "ConsentFlowContractRequestForProfileValidator"),
|
|
14102
|
+
ConsentFlowContractRequestReadStatusValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractRequestReadStatusValidator, "ConsentFlowContractRequestReadStatusValidator"),
|
|
14103
|
+
ConsentFlowContractRequestStatusValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractRequestStatusValidator, "ConsentFlowContractRequestStatusValidator"),
|
|
14096
14104
|
ConsentFlowContractValidator: /* @__PURE__ */ __name2(() => ConsentFlowContractValidator, "ConsentFlowContractValidator"),
|
|
14097
14105
|
ConsentFlowDataForDidQueryValidator: /* @__PURE__ */ __name2(() => ConsentFlowDataForDidQueryValidator, "ConsentFlowDataForDidQueryValidator"),
|
|
14098
14106
|
ConsentFlowDataQueryValidator: /* @__PURE__ */ __name2(() => ConsentFlowDataQueryValidator, "ConsentFlowDataQueryValidator"),
|
|
@@ -14125,6 +14133,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
14125
14133
|
CredentialActivityValidator: /* @__PURE__ */ __name2(() => CredentialActivityValidator, "CredentialActivityValidator"),
|
|
14126
14134
|
CredentialActivityWithDetailsValidator: /* @__PURE__ */ __name2(() => CredentialActivityWithDetailsValidator, "CredentialActivityWithDetailsValidator"),
|
|
14127
14135
|
CredentialInfoValidator: /* @__PURE__ */ __name2(() => CredentialInfoValidator, "CredentialInfoValidator"),
|
|
14136
|
+
CredentialNameRefValidator: /* @__PURE__ */ __name2(() => CredentialNameRefValidator, "CredentialNameRefValidator"),
|
|
14128
14137
|
CredentialRecordValidator: /* @__PURE__ */ __name2(() => CredentialRecordValidator, "CredentialRecordValidator"),
|
|
14129
14138
|
CredentialSchemaValidator: /* @__PURE__ */ __name2(() => CredentialSchemaValidator, "CredentialSchemaValidator"),
|
|
14130
14139
|
CredentialStatusValidator: /* @__PURE__ */ __name2(() => CredentialStatusValidator, "CredentialStatusValidator"),
|
|
@@ -14146,6 +14155,7 @@ var require_types_cjs_development = __commonJS2({
|
|
|
14146
14155
|
GetFullSkillTreeResultValidator: /* @__PURE__ */ __name2(() => GetFullSkillTreeResultValidator, "GetFullSkillTreeResultValidator"),
|
|
14147
14156
|
GetSkillPathInputValidator: /* @__PURE__ */ __name2(() => GetSkillPathInputValidator, "GetSkillPathInputValidator"),
|
|
14148
14157
|
GetSkillPathResultValidator: /* @__PURE__ */ __name2(() => GetSkillPathResultValidator, "GetSkillPathResultValidator"),
|
|
14158
|
+
GetTemplateRecipientsEventValidator: /* @__PURE__ */ __name2(() => GetTemplateRecipientsEventValidator, "GetTemplateRecipientsEventValidator"),
|
|
14149
14159
|
IdentifierEntryValidator: /* @__PURE__ */ __name2(() => IdentifierEntryValidator, "IdentifierEntryValidator"),
|
|
14150
14160
|
IdentifierTypeValidator: /* @__PURE__ */ __name2(() => IdentifierTypeValidator, "IdentifierTypeValidator"),
|
|
14151
14161
|
IdentityObjectValidator: /* @__PURE__ */ __name2(() => IdentityObjectValidator, "IdentityObjectValidator"),
|
|
@@ -28855,6 +28865,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
28855
28865
|
autoBoosts: external_exports2.string().array().optional(),
|
|
28856
28866
|
writers: external_exports2.array(LCNProfileValidator).optional()
|
|
28857
28867
|
});
|
|
28868
|
+
var ConsentFlowContractRequestStatusValidator = external_exports2.enum(["pending", "accepted", "denied"]).nullable();
|
|
28869
|
+
var ConsentFlowContractRequestReadStatusValidator = external_exports2.enum(["unseen", "seen"]).nullable();
|
|
28870
|
+
var ConsentFlowContractRequestForProfileValidator = external_exports2.object({
|
|
28871
|
+
profile: LCNProfileValidator,
|
|
28872
|
+
status: ConsentFlowContractRequestStatusValidator,
|
|
28873
|
+
readStatus: ConsentFlowContractRequestReadStatusValidator.optional()
|
|
28874
|
+
});
|
|
28875
|
+
var ConsentFlowContractRequestForProfileListValidator = external_exports2.array(
|
|
28876
|
+
ConsentFlowContractRequestForProfileValidator
|
|
28877
|
+
);
|
|
28858
28878
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
|
28859
28879
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
|
28860
28880
|
});
|
|
@@ -29015,7 +29035,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29015
29035
|
"PROFILE_PARENT_APPROVED",
|
|
29016
29036
|
"APP_LISTING_SUBMITTED",
|
|
29017
29037
|
"APP_LISTING_APPROVED",
|
|
29018
|
-
"APP_LISTING_REJECTED"
|
|
29038
|
+
"APP_LISTING_REJECTED",
|
|
29039
|
+
"APP_LISTING_WITHDRAWN",
|
|
29040
|
+
"DEVICE_LINK_REQUEST"
|
|
29019
29041
|
]);
|
|
29020
29042
|
var LCNNotificationMessageValidator = external_exports2.object({
|
|
29021
29043
|
title: external_exports2.string().optional(),
|
|
@@ -29154,6 +29176,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29154
29176
|
webhookUrl: external_exports2.string().optional(),
|
|
29155
29177
|
boostUri: external_exports2.string().optional(),
|
|
29156
29178
|
activityId: external_exports2.string().optional(),
|
|
29179
|
+
integrationId: external_exports2.string().optional(),
|
|
29157
29180
|
signingAuthority: external_exports2.object({
|
|
29158
29181
|
endpoint: external_exports2.string().optional(),
|
|
29159
29182
|
name: external_exports2.string().optional()
|
|
@@ -29255,8 +29278,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29255
29278
|
claimUrl: external_exports2.string().url().optional(),
|
|
29256
29279
|
recipientDid: external_exports2.string().optional()
|
|
29257
29280
|
});
|
|
29281
|
+
var CredentialNameRefValidator = external_exports2.object({ name: external_exports2.string() }).passthrough();
|
|
29258
29282
|
var ClaimInboxCredentialValidator = external_exports2.object({
|
|
29259
|
-
credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).describe("The credential to issue."),
|
|
29283
|
+
credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
|
|
29260
29284
|
configuration: external_exports2.object({
|
|
29261
29285
|
publishableKey: external_exports2.string(),
|
|
29262
29286
|
signingAuthorityName: external_exports2.string().optional(),
|
|
@@ -29540,6 +29564,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29540
29564
|
"DEMOTED"
|
|
29541
29565
|
]);
|
|
29542
29566
|
var AgeRatingValidator = external_exports2.enum(["4+", "9+", "12+", "17+"]);
|
|
29567
|
+
var AppStoreListingSubmitterValidator = external_exports2.object({
|
|
29568
|
+
profileId: external_exports2.string(),
|
|
29569
|
+
displayName: external_exports2.string(),
|
|
29570
|
+
email: external_exports2.string().optional()
|
|
29571
|
+
});
|
|
29543
29572
|
var AppStoreListingValidator = external_exports2.object({
|
|
29544
29573
|
listing_id: external_exports2.string(),
|
|
29545
29574
|
slug: external_exports2.string().optional(),
|
|
@@ -29561,7 +29590,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29561
29590
|
screenshots: external_exports2.array(external_exports2.string()).optional(),
|
|
29562
29591
|
hero_background_color: external_exports2.string().optional(),
|
|
29563
29592
|
min_age: external_exports2.number().int().min(0).max(18).optional(),
|
|
29564
|
-
age_rating: AgeRatingValidator.optional()
|
|
29593
|
+
age_rating: AgeRatingValidator.optional(),
|
|
29594
|
+
submitted_at: external_exports2.string().optional(),
|
|
29595
|
+
submitter: AppStoreListingSubmitterValidator.optional(),
|
|
29596
|
+
contact_email: external_exports2.string().email().optional()
|
|
29565
29597
|
});
|
|
29566
29598
|
var AppStoreListingCreateValidator = AppStoreListingValidator.omit({
|
|
29567
29599
|
listing_id: true,
|
|
@@ -29589,9 +29621,39 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29589
29621
|
var SendCredentialEventValidator = external_exports2.object({
|
|
29590
29622
|
type: external_exports2.literal("send-credential"),
|
|
29591
29623
|
templateAlias: external_exports2.string(),
|
|
29592
|
-
templateData: external_exports2.record(external_exports2.string(), external_exports2.unknown()).optional()
|
|
29624
|
+
templateData: external_exports2.record(external_exports2.string(), external_exports2.unknown()).optional(),
|
|
29625
|
+
preventDuplicateClaim: external_exports2.boolean().optional()
|
|
29626
|
+
});
|
|
29627
|
+
var CheckCredentialEventValidator = external_exports2.object({
|
|
29628
|
+
type: external_exports2.literal("check-credential"),
|
|
29629
|
+
templateAlias: external_exports2.string().optional(),
|
|
29630
|
+
boostUri: external_exports2.string().optional()
|
|
29631
|
+
}).refine((input) => Boolean(input.templateAlias) !== Boolean(input.boostUri), {
|
|
29632
|
+
message: "Exactly one of templateAlias or boostUri is required"
|
|
29633
|
+
});
|
|
29634
|
+
var CheckIssuanceStatusEventValidator = external_exports2.object({
|
|
29635
|
+
type: external_exports2.literal("check-issuance-status"),
|
|
29636
|
+
templateAlias: external_exports2.string().optional(),
|
|
29637
|
+
boostUri: external_exports2.string().optional(),
|
|
29638
|
+
recipient: external_exports2.string()
|
|
29639
|
+
}).refine((input) => Boolean(input.templateAlias) !== Boolean(input.boostUri), {
|
|
29640
|
+
message: "Exactly one of templateAlias or boostUri is required"
|
|
29593
29641
|
});
|
|
29594
|
-
var
|
|
29642
|
+
var GetTemplateRecipientsEventValidator = external_exports2.object({
|
|
29643
|
+
type: external_exports2.literal("get-template-recipients"),
|
|
29644
|
+
templateAlias: external_exports2.string().optional(),
|
|
29645
|
+
boostUri: external_exports2.string().optional(),
|
|
29646
|
+
limit: external_exports2.number().optional(),
|
|
29647
|
+
cursor: external_exports2.string().optional()
|
|
29648
|
+
}).refine((input) => Boolean(input.templateAlias) !== Boolean(input.boostUri), {
|
|
29649
|
+
message: "Exactly one of templateAlias or boostUri is required"
|
|
29650
|
+
});
|
|
29651
|
+
var AppEventValidator = external_exports2.discriminatedUnion("type", [
|
|
29652
|
+
SendCredentialEventValidator,
|
|
29653
|
+
CheckCredentialEventValidator,
|
|
29654
|
+
CheckIssuanceStatusEventValidator,
|
|
29655
|
+
GetTemplateRecipientsEventValidator
|
|
29656
|
+
]);
|
|
29595
29657
|
var AppEventInputValidator = external_exports2.object({
|
|
29596
29658
|
listingId: external_exports2.string(),
|
|
29597
29659
|
event: AppEventValidator
|
|
@@ -29654,6 +29716,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29654
29716
|
failed: external_exports2.number(),
|
|
29655
29717
|
claimRate: external_exports2.number()
|
|
29656
29718
|
});
|
|
29719
|
+
var AuthSessionError = class extends Error {
|
|
29720
|
+
static {
|
|
29721
|
+
__name(this, "AuthSessionError");
|
|
29722
|
+
}
|
|
29723
|
+
static {
|
|
29724
|
+
__name2(this, "AuthSessionError");
|
|
29725
|
+
}
|
|
29726
|
+
constructor(message, reason) {
|
|
29727
|
+
super(message);
|
|
29728
|
+
this.reason = reason;
|
|
29729
|
+
this.name = "AuthSessionError";
|
|
29730
|
+
}
|
|
29731
|
+
static {
|
|
29732
|
+
__name22(this, "AuthSessionError");
|
|
29733
|
+
}
|
|
29734
|
+
};
|
|
29657
29735
|
}
|
|
29658
29736
|
});
|
|
29659
29737
|
var require_dist = __commonJS2({
|
|
@@ -31653,7 +31731,7 @@ var callbackLink = /* @__PURE__ */ __name((callback) => {
|
|
|
31653
31731
|
}, "callbackLink");
|
|
31654
31732
|
|
|
31655
31733
|
// src/index.ts
|
|
31656
|
-
var getClient = /* @__PURE__ */ __name(async (url2, didAuthFunction) => {
|
|
31734
|
+
var getClient = /* @__PURE__ */ __name(async (url2, didAuthFunction, guardianApprovalGetter) => {
|
|
31657
31735
|
let challenges = [];
|
|
31658
31736
|
const challengeRequester = createTRPCClient({
|
|
31659
31737
|
links: [
|
|
@@ -31684,7 +31762,11 @@ var getClient = /* @__PURE__ */ __name(async (url2, didAuthFunction) => {
|
|
|
31684
31762
|
url: url2,
|
|
31685
31763
|
headers: /* @__PURE__ */ __name(async () => {
|
|
31686
31764
|
if (challenges.length === 0) challenges.push(...await getChallenges());
|
|
31687
|
-
|
|
31765
|
+
const guardianApproval = guardianApprovalGetter ? await guardianApprovalGetter() : void 0;
|
|
31766
|
+
return {
|
|
31767
|
+
Authorization: `Bearer ${await didAuthFunction(challenges.pop())}`,
|
|
31768
|
+
...guardianApproval ? { "x-guardian-approval": guardianApproval } : {}
|
|
31769
|
+
};
|
|
31688
31770
|
}, "headers"),
|
|
31689
31771
|
transformer: {
|
|
31690
31772
|
input: RegExpTransformer,
|
|
@@ -31695,14 +31777,20 @@ var getClient = /* @__PURE__ */ __name(async (url2, didAuthFunction) => {
|
|
|
31695
31777
|
});
|
|
31696
31778
|
return trpc;
|
|
31697
31779
|
}, "getClient");
|
|
31698
|
-
var getApiTokenClient = /* @__PURE__ */ __name(async (url2, apiToken) => {
|
|
31780
|
+
var getApiTokenClient = /* @__PURE__ */ __name(async (url2, apiToken, guardianApprovalGetter) => {
|
|
31699
31781
|
const trpc = createTRPCClient({
|
|
31700
31782
|
links: [
|
|
31701
31783
|
httpBatchLink({
|
|
31702
31784
|
methodOverride: "POST",
|
|
31703
31785
|
url: url2,
|
|
31704
31786
|
maxURLLength: 3072,
|
|
31705
|
-
headers:
|
|
31787
|
+
headers: /* @__PURE__ */ __name(async () => {
|
|
31788
|
+
const guardianApproval = guardianApprovalGetter ? await guardianApprovalGetter() : void 0;
|
|
31789
|
+
return {
|
|
31790
|
+
Authorization: `Bearer ${apiToken}`,
|
|
31791
|
+
...guardianApproval ? { "x-guardian-approval": guardianApproval } : {}
|
|
31792
|
+
};
|
|
31793
|
+
}, "headers"),
|
|
31706
31794
|
transformer: {
|
|
31707
31795
|
input: RegExpTransformer,
|
|
31708
31796
|
output: { serialize: /* @__PURE__ */ __name((o) => o, "serialize"), deserialize: /* @__PURE__ */ __name((o) => o, "deserialize") }
|