@hypercerts-org/sdk-core 0.10.0-beta.4 → 0.10.0-beta.5
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 +153 -0
- package/README.md +131 -6
- package/dist/index.cjs +2597 -320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1900 -169
- package/dist/index.mjs +3588 -1341
- package/dist/index.mjs.map +1 -1
- package/dist/lexicons.cjs +446 -34
- package/dist/lexicons.cjs.map +1 -1
- package/dist/lexicons.d.ts +248 -8
- package/dist/lexicons.mjs +422 -11
- package/dist/lexicons.mjs.map +1 -1
- package/dist/testing.d.ts +56 -9
- package/dist/types.cjs +89 -9
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +358 -66
- package/dist/types.mjs +89 -9
- package/dist/types.mjs.map +1 -1
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OAuthSession, NodeSavedSession, NodeSavedState } from '@atproto/oauth-client-node';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { EventEmitter } from 'eventemitter3';
|
|
4
|
-
import {
|
|
4
|
+
import { OrgHypercertsClaimActivity, OrgHypercertsClaimCollection, OrgHypercertsClaimRights, AppCertifiedLocation, OrgHypercertsClaimContributionDetails, OrgHypercertsClaimContributorInformation, OrgHypercertsClaimMeasurement, OrgHypercertsClaimEvaluation, OrgHypercertsHelperWorkScopeTag, OrgHypercertsClaimEvidence, OrgHypercertsDefs } from '@hypercerts-org/lexicon';
|
|
5
5
|
export { BlobRef, JsonBlobRef } from '@atproto/lexicon';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -738,22 +738,28 @@ interface LoggerInterface {
|
|
|
738
738
|
* Zod schema for OAuth configuration validation.
|
|
739
739
|
*
|
|
740
740
|
* @remarks
|
|
741
|
-
* All URLs must be valid and use HTTPS in production.
|
|
742
|
-
*
|
|
741
|
+
* All URLs must be valid and use HTTPS in production. For local development,
|
|
742
|
+
* HTTP loopback URLs (localhost, 127.0.0.1, [::1]) are allowed.
|
|
743
|
+
* The `jwkPrivate` field should contain the private key in JWK (JSON Web Key) format as a string.
|
|
743
744
|
*/
|
|
744
745
|
declare const OAuthConfigSchema: z.ZodObject<{
|
|
745
746
|
/**
|
|
746
747
|
* URL to the OAuth client metadata JSON document.
|
|
747
748
|
* This document describes your application to the authorization server.
|
|
748
749
|
*
|
|
750
|
+
* For local development, you can use `http://localhost/` as a loopback client.
|
|
751
|
+
*
|
|
749
752
|
* @see https://atproto.com/specs/oauth#client-metadata
|
|
750
753
|
*/
|
|
751
|
-
clientId: z.ZodString
|
|
754
|
+
clientId: z.ZodEffects<z.ZodString, string, string>;
|
|
752
755
|
/**
|
|
753
756
|
* URL where users are redirected after authentication.
|
|
754
757
|
* Must match one of the redirect URIs in your client metadata.
|
|
758
|
+
*
|
|
759
|
+
* For local development, you can use HTTP loopback URLs like
|
|
760
|
+
* `http://127.0.0.1:3000/callback` or `http://localhost:3000/callback`.
|
|
755
761
|
*/
|
|
756
|
-
redirectUri: z.ZodString
|
|
762
|
+
redirectUri: z.ZodEffects<z.ZodString, string, string>;
|
|
757
763
|
/**
|
|
758
764
|
* OAuth scopes to request, space-separated.
|
|
759
765
|
*
|
|
@@ -787,8 +793,11 @@ declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
787
793
|
/**
|
|
788
794
|
* URL to your public JWKS (JSON Web Key Set) endpoint.
|
|
789
795
|
* Used by the authorization server to verify your client's signatures.
|
|
796
|
+
*
|
|
797
|
+
* For local development, you can serve JWKS from a loopback URL like
|
|
798
|
+
* `http://127.0.0.1:3000/.well-known/jwks.json`.
|
|
790
799
|
*/
|
|
791
|
-
jwksUri: z.ZodString
|
|
800
|
+
jwksUri: z.ZodEffects<z.ZodString, string, string>;
|
|
792
801
|
/**
|
|
793
802
|
* Private JWK (JSON Web Key) as a JSON string.
|
|
794
803
|
* Used for signing DPoP proofs and client assertions.
|
|
@@ -798,40 +807,78 @@ declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
798
807
|
* Typically loaded from environment variables or a secrets manager.
|
|
799
808
|
*/
|
|
800
809
|
jwkPrivate: z.ZodString;
|
|
810
|
+
/**
|
|
811
|
+
* Enable development mode features (optional).
|
|
812
|
+
*
|
|
813
|
+
* When true, suppresses warnings about using HTTP loopback URLs.
|
|
814
|
+
* Should be set to true for local development to reduce console noise.
|
|
815
|
+
*
|
|
816
|
+
* @default false
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* ```typescript
|
|
820
|
+
* oauth: {
|
|
821
|
+
* clientId: "http://localhost/",
|
|
822
|
+
* redirectUri: "http://127.0.0.1:3000/callback",
|
|
823
|
+
* // ... other config
|
|
824
|
+
* developmentMode: true, // Suppress loopback warnings
|
|
825
|
+
* }
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
developmentMode: z.ZodOptional<z.ZodBoolean>;
|
|
801
829
|
}, "strip", z.ZodTypeAny, {
|
|
802
830
|
clientId: string;
|
|
803
831
|
redirectUri: string;
|
|
804
832
|
scope: string;
|
|
805
833
|
jwksUri: string;
|
|
806
834
|
jwkPrivate: string;
|
|
835
|
+
developmentMode?: boolean | undefined;
|
|
807
836
|
}, {
|
|
808
837
|
clientId: string;
|
|
809
838
|
redirectUri: string;
|
|
810
839
|
scope: string;
|
|
811
840
|
jwksUri: string;
|
|
812
841
|
jwkPrivate: string;
|
|
842
|
+
developmentMode?: boolean | undefined;
|
|
813
843
|
}>;
|
|
814
844
|
/**
|
|
815
845
|
* Zod schema for server URL configuration.
|
|
816
846
|
*
|
|
817
847
|
* @remarks
|
|
818
848
|
* At least one server (PDS or SDS) should be configured for the SDK to be useful.
|
|
849
|
+
* For local development, HTTP loopback URLs are allowed.
|
|
819
850
|
*/
|
|
820
851
|
declare const ServerConfigSchema: z.ZodObject<{
|
|
821
852
|
/**
|
|
822
853
|
* Personal Data Server URL - the user's own AT Protocol server.
|
|
823
854
|
* This is the primary server for user data operations.
|
|
824
855
|
*
|
|
825
|
-
* @example
|
|
856
|
+
* @example Production
|
|
857
|
+
* ```typescript
|
|
858
|
+
* pds: "https://bsky.social"
|
|
859
|
+
* ```
|
|
860
|
+
*
|
|
861
|
+
* @example Local development
|
|
862
|
+
* ```typescript
|
|
863
|
+
* pds: "http://localhost:2583"
|
|
864
|
+
* ```
|
|
826
865
|
*/
|
|
827
|
-
pds: z.ZodOptional<z.ZodString
|
|
866
|
+
pds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
828
867
|
/**
|
|
829
868
|
* Shared Data Server URL - for collaborative data storage.
|
|
830
869
|
* Required for collaborator and organization operations.
|
|
831
870
|
*
|
|
832
|
-
* @example
|
|
871
|
+
* @example Production
|
|
872
|
+
* ```typescript
|
|
873
|
+
* sds: "https://sds.hypercerts.org"
|
|
874
|
+
* ```
|
|
875
|
+
*
|
|
876
|
+
* @example Local development
|
|
877
|
+
* ```typescript
|
|
878
|
+
* sds: "http://127.0.0.1:2584"
|
|
879
|
+
* ```
|
|
833
880
|
*/
|
|
834
|
-
sds: z.ZodOptional<z.ZodString
|
|
881
|
+
sds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
835
882
|
}, "strip", z.ZodTypeAny, {
|
|
836
883
|
pds?: string | undefined;
|
|
837
884
|
sds?: string | undefined;
|
|
@@ -877,14 +924,19 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
877
924
|
* URL to the OAuth client metadata JSON document.
|
|
878
925
|
* This document describes your application to the authorization server.
|
|
879
926
|
*
|
|
927
|
+
* For local development, you can use `http://localhost/` as a loopback client.
|
|
928
|
+
*
|
|
880
929
|
* @see https://atproto.com/specs/oauth#client-metadata
|
|
881
930
|
*/
|
|
882
|
-
clientId: z.ZodString
|
|
931
|
+
clientId: z.ZodEffects<z.ZodString, string, string>;
|
|
883
932
|
/**
|
|
884
933
|
* URL where users are redirected after authentication.
|
|
885
934
|
* Must match one of the redirect URIs in your client metadata.
|
|
935
|
+
*
|
|
936
|
+
* For local development, you can use HTTP loopback URLs like
|
|
937
|
+
* `http://127.0.0.1:3000/callback` or `http://localhost:3000/callback`.
|
|
886
938
|
*/
|
|
887
|
-
redirectUri: z.ZodString
|
|
939
|
+
redirectUri: z.ZodEffects<z.ZodString, string, string>;
|
|
888
940
|
/**
|
|
889
941
|
* OAuth scopes to request, space-separated.
|
|
890
942
|
*
|
|
@@ -918,8 +970,11 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
918
970
|
/**
|
|
919
971
|
* URL to your public JWKS (JSON Web Key Set) endpoint.
|
|
920
972
|
* Used by the authorization server to verify your client's signatures.
|
|
973
|
+
*
|
|
974
|
+
* For local development, you can serve JWKS from a loopback URL like
|
|
975
|
+
* `http://127.0.0.1:3000/.well-known/jwks.json`.
|
|
921
976
|
*/
|
|
922
|
-
jwksUri: z.ZodString
|
|
977
|
+
jwksUri: z.ZodEffects<z.ZodString, string, string>;
|
|
923
978
|
/**
|
|
924
979
|
* Private JWK (JSON Web Key) as a JSON string.
|
|
925
980
|
* Used for signing DPoP proofs and client assertions.
|
|
@@ -929,34 +984,71 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
929
984
|
* Typically loaded from environment variables or a secrets manager.
|
|
930
985
|
*/
|
|
931
986
|
jwkPrivate: z.ZodString;
|
|
987
|
+
/**
|
|
988
|
+
* Enable development mode features (optional).
|
|
989
|
+
*
|
|
990
|
+
* When true, suppresses warnings about using HTTP loopback URLs.
|
|
991
|
+
* Should be set to true for local development to reduce console noise.
|
|
992
|
+
*
|
|
993
|
+
* @default false
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* ```typescript
|
|
997
|
+
* oauth: {
|
|
998
|
+
* clientId: "http://localhost/",
|
|
999
|
+
* redirectUri: "http://127.0.0.1:3000/callback",
|
|
1000
|
+
* // ... other config
|
|
1001
|
+
* developmentMode: true, // Suppress loopback warnings
|
|
1002
|
+
* }
|
|
1003
|
+
* ```
|
|
1004
|
+
*/
|
|
1005
|
+
developmentMode: z.ZodOptional<z.ZodBoolean>;
|
|
932
1006
|
}, "strip", z.ZodTypeAny, {
|
|
933
1007
|
clientId: string;
|
|
934
1008
|
redirectUri: string;
|
|
935
1009
|
scope: string;
|
|
936
1010
|
jwksUri: string;
|
|
937
1011
|
jwkPrivate: string;
|
|
1012
|
+
developmentMode?: boolean | undefined;
|
|
938
1013
|
}, {
|
|
939
1014
|
clientId: string;
|
|
940
1015
|
redirectUri: string;
|
|
941
1016
|
scope: string;
|
|
942
1017
|
jwksUri: string;
|
|
943
1018
|
jwkPrivate: string;
|
|
1019
|
+
developmentMode?: boolean | undefined;
|
|
944
1020
|
}>;
|
|
945
1021
|
servers: z.ZodOptional<z.ZodObject<{
|
|
946
1022
|
/**
|
|
947
1023
|
* Personal Data Server URL - the user's own AT Protocol server.
|
|
948
1024
|
* This is the primary server for user data operations.
|
|
949
1025
|
*
|
|
950
|
-
* @example
|
|
1026
|
+
* @example Production
|
|
1027
|
+
* ```typescript
|
|
1028
|
+
* pds: "https://bsky.social"
|
|
1029
|
+
* ```
|
|
1030
|
+
*
|
|
1031
|
+
* @example Local development
|
|
1032
|
+
* ```typescript
|
|
1033
|
+
* pds: "http://localhost:2583"
|
|
1034
|
+
* ```
|
|
951
1035
|
*/
|
|
952
|
-
pds: z.ZodOptional<z.ZodString
|
|
1036
|
+
pds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
953
1037
|
/**
|
|
954
1038
|
* Shared Data Server URL - for collaborative data storage.
|
|
955
1039
|
* Required for collaborator and organization operations.
|
|
956
1040
|
*
|
|
957
|
-
* @example
|
|
1041
|
+
* @example Production
|
|
1042
|
+
* ```typescript
|
|
1043
|
+
* sds: "https://sds.hypercerts.org"
|
|
1044
|
+
* ```
|
|
1045
|
+
*
|
|
1046
|
+
* @example Local development
|
|
1047
|
+
* ```typescript
|
|
1048
|
+
* sds: "http://127.0.0.1:2584"
|
|
1049
|
+
* ```
|
|
958
1050
|
*/
|
|
959
|
-
sds: z.ZodOptional<z.ZodString
|
|
1051
|
+
sds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
960
1052
|
}, "strip", z.ZodTypeAny, {
|
|
961
1053
|
pds?: string | undefined;
|
|
962
1054
|
sds?: string | undefined;
|
|
@@ -989,6 +1081,7 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
989
1081
|
scope: string;
|
|
990
1082
|
jwksUri: string;
|
|
991
1083
|
jwkPrivate: string;
|
|
1084
|
+
developmentMode?: boolean | undefined;
|
|
992
1085
|
};
|
|
993
1086
|
servers?: {
|
|
994
1087
|
pds?: string | undefined;
|
|
@@ -1005,6 +1098,7 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
1005
1098
|
scope: string;
|
|
1006
1099
|
jwksUri: string;
|
|
1007
1100
|
jwkPrivate: string;
|
|
1101
|
+
developmentMode?: boolean | undefined;
|
|
1008
1102
|
};
|
|
1009
1103
|
servers?: {
|
|
1010
1104
|
pds?: string | undefined;
|
|
@@ -1242,12 +1336,18 @@ interface ProgressStep {
|
|
|
1242
1336
|
|
|
1243
1337
|
type HypercertClaim = OrgHypercertsClaimActivity.Main;
|
|
1244
1338
|
type HypercertRights = OrgHypercertsClaimRights.Main;
|
|
1245
|
-
type
|
|
1339
|
+
type HypercertContributionDetails = OrgHypercertsClaimContributionDetails.Main;
|
|
1340
|
+
type HypercertContributorInformation = OrgHypercertsClaimContributorInformation.Main;
|
|
1341
|
+
/** Contributor entry in an activity - can be inline or reference external records */
|
|
1342
|
+
type HypercertContributor = OrgHypercertsClaimActivity.Contributor;
|
|
1246
1343
|
type HypercertMeasurement = OrgHypercertsClaimMeasurement.Main;
|
|
1247
1344
|
type HypercertEvaluation = OrgHypercertsClaimEvaluation.Main;
|
|
1248
1345
|
type HypercertEvidence = OrgHypercertsClaimEvidence.Main;
|
|
1249
1346
|
type HypercertCollection = OrgHypercertsClaimCollection.Main;
|
|
1250
|
-
|
|
1347
|
+
/** Collection item with optional weight */
|
|
1348
|
+
type HypercertCollectionItem = OrgHypercertsClaimCollection.Item;
|
|
1349
|
+
/** Work scope tag for creating reusable scope atoms */
|
|
1350
|
+
type HypercertWorkScopeTag = OrgHypercertsHelperWorkScopeTag.Main;
|
|
1251
1351
|
type HypercertLocation = AppCertifiedLocation.Main;
|
|
1252
1352
|
/**
|
|
1253
1353
|
* Image input for SDK operations.
|
|
@@ -1279,6 +1379,58 @@ interface HypercertWithMetadata {
|
|
|
1279
1379
|
cid: string;
|
|
1280
1380
|
record: HypercertClaim;
|
|
1281
1381
|
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Project type - a HypercertCollection with type='project'.
|
|
1384
|
+
*/
|
|
1385
|
+
interface HypercertProject extends HypercertCollection {
|
|
1386
|
+
type: "project";
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* HypercertProject with AT Protocol metadata.
|
|
1390
|
+
*/
|
|
1391
|
+
interface HypercertProjectWithMetadata {
|
|
1392
|
+
uri: string;
|
|
1393
|
+
cid: string;
|
|
1394
|
+
record: HypercertProject;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Parameters for creating a project.
|
|
1398
|
+
*/
|
|
1399
|
+
interface CreateProjectParams {
|
|
1400
|
+
title: string;
|
|
1401
|
+
shortDescription: string;
|
|
1402
|
+
description?: unknown;
|
|
1403
|
+
avatar?: Blob;
|
|
1404
|
+
banner?: Blob;
|
|
1405
|
+
activities?: Array<{
|
|
1406
|
+
uri: string;
|
|
1407
|
+
cid: string;
|
|
1408
|
+
weight: string;
|
|
1409
|
+
}>;
|
|
1410
|
+
location?: {
|
|
1411
|
+
uri: string;
|
|
1412
|
+
cid: string;
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Parameters for updating a project.
|
|
1417
|
+
*/
|
|
1418
|
+
interface UpdateProjectParams {
|
|
1419
|
+
title?: string;
|
|
1420
|
+
shortDescription?: string;
|
|
1421
|
+
description?: unknown;
|
|
1422
|
+
avatar?: Blob;
|
|
1423
|
+
banner?: Blob;
|
|
1424
|
+
activities?: Array<{
|
|
1425
|
+
uri: string;
|
|
1426
|
+
cid: string;
|
|
1427
|
+
weight: string;
|
|
1428
|
+
}>;
|
|
1429
|
+
location?: {
|
|
1430
|
+
uri: string;
|
|
1431
|
+
cid: string;
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1282
1434
|
|
|
1283
1435
|
/**
|
|
1284
1436
|
* Parameters for creating a new hypercert.
|
|
@@ -1360,14 +1512,12 @@ interface CreateHypercertParams {
|
|
|
1360
1512
|
description: string;
|
|
1361
1513
|
/**
|
|
1362
1514
|
* Scope of work or impact area.
|
|
1363
|
-
* Logical scope of the work using label-based conditions.
|
|
1515
|
+
* Logical scope of the work using label-based conditions.
|
|
1364
1516
|
*
|
|
1365
|
-
* @example
|
|
1517
|
+
* @example WorkScopeAll with atom references
|
|
1366
1518
|
*/
|
|
1367
|
-
workScope?: {
|
|
1368
|
-
|
|
1369
|
-
withinAnyOf?: string[];
|
|
1370
|
-
withinNoneOf?: string[];
|
|
1519
|
+
workScope?: OrgHypercertsDefs.WorkScopeAll | OrgHypercertsDefs.WorkScopeAny | OrgHypercertsDefs.WorkScopeNot | OrgHypercertsDefs.WorkScopeAtom | {
|
|
1520
|
+
$type: string;
|
|
1371
1521
|
};
|
|
1372
1522
|
/**
|
|
1373
1523
|
* Start date of the work period.
|
|
@@ -1419,34 +1569,7 @@ interface CreateHypercertParams {
|
|
|
1419
1569
|
/**
|
|
1420
1570
|
* Optional geographic location of the impact.
|
|
1421
1571
|
*/
|
|
1422
|
-
location?:
|
|
1423
|
-
/**
|
|
1424
|
-
* Location value/address.
|
|
1425
|
-
*
|
|
1426
|
-
* @example "San Francisco, CA, USA"
|
|
1427
|
-
*/
|
|
1428
|
-
value: string;
|
|
1429
|
-
/**
|
|
1430
|
-
* Human-readable location name.
|
|
1431
|
-
*
|
|
1432
|
-
* @example "SF Bay Area"
|
|
1433
|
-
*/
|
|
1434
|
-
name?: string;
|
|
1435
|
-
/**
|
|
1436
|
-
* Description of the location scope.
|
|
1437
|
-
*/
|
|
1438
|
-
description?: string;
|
|
1439
|
-
/**
|
|
1440
|
-
* Spatial Reference System identifier (required if location is provided).
|
|
1441
|
-
*
|
|
1442
|
-
* @example "EPSG:4326" for WGS84
|
|
1443
|
-
*/
|
|
1444
|
-
srs: string;
|
|
1445
|
-
/**
|
|
1446
|
-
* GeoJSON file as a Blob for precise boundaries.
|
|
1447
|
-
*/
|
|
1448
|
-
geojson?: Blob;
|
|
1449
|
-
};
|
|
1572
|
+
location?: AttachLocationParams;
|
|
1450
1573
|
/**
|
|
1451
1574
|
* Optional list of contributions to the impact.
|
|
1452
1575
|
*
|
|
@@ -1471,7 +1594,7 @@ interface CreateHypercertParams {
|
|
|
1471
1594
|
/**
|
|
1472
1595
|
* Optional evidence supporting the impact claim.
|
|
1473
1596
|
*/
|
|
1474
|
-
evidence?:
|
|
1597
|
+
evidence?: Array<Omit<CreateHypercertEvidenceParams, "subjectUri">>;
|
|
1475
1598
|
/**
|
|
1476
1599
|
* Optional callback for progress updates during creation.
|
|
1477
1600
|
*
|
|
@@ -1496,6 +1619,88 @@ interface CreateOrganizationParams {
|
|
|
1496
1619
|
*/
|
|
1497
1620
|
description?: string;
|
|
1498
1621
|
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Input params for creating Hypercert evidence.
|
|
1624
|
+
*
|
|
1625
|
+
* Based on `org.hypercerts.claim.evidence` but:
|
|
1626
|
+
* - removes: $type, createdAt, subject, content
|
|
1627
|
+
* - adds: subjectUri, content (string | Blob)
|
|
1628
|
+
*/
|
|
1629
|
+
interface CreateHypercertEvidenceParams {
|
|
1630
|
+
/**
|
|
1631
|
+
* URI for the subject this evidence is attached to.
|
|
1632
|
+
*/
|
|
1633
|
+
subjectUri: string;
|
|
1634
|
+
/**
|
|
1635
|
+
* Evidence content.
|
|
1636
|
+
* - string: should be a URI.
|
|
1637
|
+
* - Blob: binary payload (e.g. image/pdf)
|
|
1638
|
+
*/
|
|
1639
|
+
content: string | Blob;
|
|
1640
|
+
/**
|
|
1641
|
+
* Title to describe the nature of the evidence.
|
|
1642
|
+
*/
|
|
1643
|
+
title: string;
|
|
1644
|
+
/**
|
|
1645
|
+
* Short description explaining what this evidence shows.
|
|
1646
|
+
*/
|
|
1647
|
+
shortDescription?: string;
|
|
1648
|
+
/**
|
|
1649
|
+
* Longer description describing the evidence in more detail.
|
|
1650
|
+
*/
|
|
1651
|
+
description?: string;
|
|
1652
|
+
/**
|
|
1653
|
+
* How this evidence relates to the subject.
|
|
1654
|
+
*/
|
|
1655
|
+
relationType?: "supports" | "challenges" | "clarifies" | (string & {});
|
|
1656
|
+
/**
|
|
1657
|
+
* Any additional custom fields supported by the record.
|
|
1658
|
+
*/
|
|
1659
|
+
[k: string]: unknown;
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Parameters for attaching a location to a hypercert.
|
|
1663
|
+
*
|
|
1664
|
+
* @example Using a string location
|
|
1665
|
+
* ```typescript
|
|
1666
|
+
* const params: AttachLocationParams = {
|
|
1667
|
+
* lpVersion: "1.0.0",
|
|
1668
|
+
* srs: "EPSG:4326",
|
|
1669
|
+
* locationType: "coordinate-decimal",
|
|
1670
|
+
* location: "https://locationuri.com",
|
|
1671
|
+
* name: "San Francisco",
|
|
1672
|
+
* description: "Project location in SF Bay Area",
|
|
1673
|
+
* };
|
|
1674
|
+
* ```
|
|
1675
|
+
*
|
|
1676
|
+
* @example Using a GeoJSON Blob
|
|
1677
|
+
* ```typescript
|
|
1678
|
+
* const geojsonBlob = new Blob(
|
|
1679
|
+
* [JSON.stringify({ type: "Point", coordinates: [-122.4194, 37.7749] })],
|
|
1680
|
+
* { type: "application/geo+json" }
|
|
1681
|
+
* );
|
|
1682
|
+
* const params: AttachLocationParams = {
|
|
1683
|
+
* lpVersion: "1.0.0",
|
|
1684
|
+
* srs: "EPSG:4326",
|
|
1685
|
+
* locationType: "geojson-point",
|
|
1686
|
+
* location: geojsonBlob,
|
|
1687
|
+
* };
|
|
1688
|
+
* ```
|
|
1689
|
+
*/
|
|
1690
|
+
interface AttachLocationParams {
|
|
1691
|
+
/** The version of the Location Protocol */
|
|
1692
|
+
lpVersion: string;
|
|
1693
|
+
/** The Spatial Reference System URI (e.g., http://www.opengis.net/def/crs/OGC/1.3/CRS84) that defines the coordinate system. */
|
|
1694
|
+
srs: string;
|
|
1695
|
+
/** An identifier for the format of the location data (e.g., coordinate-decimal, geojson-point) */
|
|
1696
|
+
locationType: "coordinate-decimal" | "geojson-point" | (string & {});
|
|
1697
|
+
/** Location data as either a URL string or a GeoJSON Blob */
|
|
1698
|
+
location: string | Blob;
|
|
1699
|
+
/** Optional name for this location */
|
|
1700
|
+
name?: string;
|
|
1701
|
+
/** Optional description for this location */
|
|
1702
|
+
description?: string;
|
|
1703
|
+
}
|
|
1499
1704
|
/**
|
|
1500
1705
|
* Result of creating a hypercert.
|
|
1501
1706
|
*
|
|
@@ -1526,6 +1731,10 @@ interface CreateHypercertResult {
|
|
|
1526
1731
|
* AT-URIs of contribution records, if contributions were provided.
|
|
1527
1732
|
*/
|
|
1528
1733
|
contributionUris?: string[];
|
|
1734
|
+
/**
|
|
1735
|
+
* AT-URIs of evidence records, if evidence was provided.
|
|
1736
|
+
*/
|
|
1737
|
+
evidenceUris?: string[];
|
|
1529
1738
|
}
|
|
1530
1739
|
/**
|
|
1531
1740
|
* Low-level record operations for AT Protocol CRUD.
|
|
@@ -1840,6 +2049,26 @@ interface HypercertEvents {
|
|
|
1840
2049
|
uri: string;
|
|
1841
2050
|
cid: string;
|
|
1842
2051
|
};
|
|
2052
|
+
/**
|
|
2053
|
+
* Emitted when a project is created.
|
|
2054
|
+
*/
|
|
2055
|
+
projectCreated: {
|
|
2056
|
+
uri: string;
|
|
2057
|
+
cid: string;
|
|
2058
|
+
};
|
|
2059
|
+
/**
|
|
2060
|
+
* Emitted when a project is updated.
|
|
2061
|
+
*/
|
|
2062
|
+
projectUpdated: {
|
|
2063
|
+
uri: string;
|
|
2064
|
+
cid: string;
|
|
2065
|
+
};
|
|
2066
|
+
/**
|
|
2067
|
+
* Emitted when a project is deleted.
|
|
2068
|
+
*/
|
|
2069
|
+
projectDeleted: {
|
|
2070
|
+
uri: string;
|
|
2071
|
+
};
|
|
1843
2072
|
}
|
|
1844
2073
|
/**
|
|
1845
2074
|
* High-level hypercert operations.
|
|
@@ -1941,21 +2170,14 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
1941
2170
|
* @param location.geojson - Optional GeoJSON blob for precise boundaries
|
|
1942
2171
|
* @returns Promise resolving to location record result
|
|
1943
2172
|
*/
|
|
1944
|
-
attachLocation(uri: string, location:
|
|
1945
|
-
value: string;
|
|
1946
|
-
name?: string;
|
|
1947
|
-
description?: string;
|
|
1948
|
-
srs: string;
|
|
1949
|
-
geojson?: Blob;
|
|
1950
|
-
}): Promise<CreateResult>;
|
|
2173
|
+
attachLocation(uri: string, location: AttachLocationParams): Promise<CreateResult>;
|
|
1951
2174
|
/**
|
|
1952
2175
|
* Adds evidence to an existing hypercert.
|
|
1953
2176
|
*
|
|
1954
|
-
* @param
|
|
1955
|
-
* @param evidence - Array of evidence items to add
|
|
2177
|
+
* @param evidence - Evidence item to add
|
|
1956
2178
|
* @returns Promise resolving to update result
|
|
1957
2179
|
*/
|
|
1958
|
-
addEvidence(
|
|
2180
|
+
addEvidence(evidence: CreateHypercertEvidenceParams): Promise<UpdateResult>;
|
|
1959
2181
|
/**
|
|
1960
2182
|
* Creates a contribution record.
|
|
1961
2183
|
*
|
|
@@ -2007,7 +2229,7 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
2007
2229
|
weight: string;
|
|
2008
2230
|
}>;
|
|
2009
2231
|
shortDescription?: string;
|
|
2010
|
-
|
|
2232
|
+
banner?: Blob;
|
|
2011
2233
|
}): Promise<CreateResult>;
|
|
2012
2234
|
/**
|
|
2013
2235
|
* Gets a collection by URI.
|
|
@@ -2031,6 +2253,76 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
2031
2253
|
cid: string;
|
|
2032
2254
|
record: HypercertCollection;
|
|
2033
2255
|
}>>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Creates a project.
|
|
2258
|
+
*
|
|
2259
|
+
* @param params - Project parameters
|
|
2260
|
+
* @returns Promise resolving to project record result
|
|
2261
|
+
*/
|
|
2262
|
+
createProject(params: {
|
|
2263
|
+
title: string;
|
|
2264
|
+
shortDescription: string;
|
|
2265
|
+
description?: unknown;
|
|
2266
|
+
avatar?: Blob;
|
|
2267
|
+
banner?: Blob;
|
|
2268
|
+
activities?: Array<{
|
|
2269
|
+
uri: string;
|
|
2270
|
+
cid: string;
|
|
2271
|
+
weight: string;
|
|
2272
|
+
}>;
|
|
2273
|
+
}): Promise<CreateResult>;
|
|
2274
|
+
/**
|
|
2275
|
+
* Gets a project by URI.
|
|
2276
|
+
*
|
|
2277
|
+
* Projects are collections with type='project'.
|
|
2278
|
+
*
|
|
2279
|
+
* @param uri - AT-URI of the project
|
|
2280
|
+
* @returns Promise resolving to project data (as collection)
|
|
2281
|
+
*/
|
|
2282
|
+
getProject(uri: string): Promise<{
|
|
2283
|
+
uri: string;
|
|
2284
|
+
cid: string;
|
|
2285
|
+
record: HypercertCollection;
|
|
2286
|
+
}>;
|
|
2287
|
+
/**
|
|
2288
|
+
* Lists projects with pagination.
|
|
2289
|
+
*
|
|
2290
|
+
* Projects are collections with type='project'.
|
|
2291
|
+
*
|
|
2292
|
+
* @param params - Optional pagination parameters
|
|
2293
|
+
* @returns Promise resolving to paginated list
|
|
2294
|
+
*/
|
|
2295
|
+
listProjects(params?: ListParams): Promise<PaginatedList<{
|
|
2296
|
+
uri: string;
|
|
2297
|
+
cid: string;
|
|
2298
|
+
record: HypercertCollection;
|
|
2299
|
+
}>>;
|
|
2300
|
+
/**
|
|
2301
|
+
* Updates a project.
|
|
2302
|
+
*
|
|
2303
|
+
* @param uri - AT-URI of the project
|
|
2304
|
+
* @param updates - Fields to update
|
|
2305
|
+
* @returns Promise resolving to update result
|
|
2306
|
+
*/
|
|
2307
|
+
updateProject(uri: string, updates: {
|
|
2308
|
+
title?: string;
|
|
2309
|
+
shortDescription?: string;
|
|
2310
|
+
description?: unknown;
|
|
2311
|
+
avatar?: Blob | null;
|
|
2312
|
+
banner?: Blob | null;
|
|
2313
|
+
activities?: Array<{
|
|
2314
|
+
uri: string;
|
|
2315
|
+
cid: string;
|
|
2316
|
+
weight: string;
|
|
2317
|
+
}>;
|
|
2318
|
+
}): Promise<UpdateResult>;
|
|
2319
|
+
/**
|
|
2320
|
+
* Deletes a project.
|
|
2321
|
+
*
|
|
2322
|
+
* @param uri - AT-URI of the project
|
|
2323
|
+
* @returns Promise resolving when deleted
|
|
2324
|
+
*/
|
|
2325
|
+
deleteProject(uri: string): Promise<void>;
|
|
2034
2326
|
}
|
|
2035
2327
|
/**
|
|
2036
2328
|
* Collaborator operations for SDS access control.
|
|
@@ -2250,4 +2542,4 @@ interface AuthorizeOptions {
|
|
|
2250
2542
|
}
|
|
2251
2543
|
|
|
2252
2544
|
export { ATProtoSDKConfigSchema, CollaboratorPermissionsSchema, CollaboratorSchema, OAuthConfigSchema, OrganizationSchema, ServerConfigSchema, TimeoutConfigSchema };
|
|
2253
|
-
export type { ATProtoSDKConfig, AuthorizeOptions, BlobOperations, CacheInterface, Collaborator, CollaboratorOperations, CollaboratorPermissions, CreateHypercertParams, CreateHypercertResult, CreateResult, DID, HypercertClaim, HypercertCollection,
|
|
2545
|
+
export type { ATProtoSDKConfig, AuthorizeOptions, BlobOperations, CacheInterface, Collaborator, CollaboratorOperations, CollaboratorPermissions, CreateHypercertParams, CreateHypercertResult, CreateProjectParams, CreateResult, DID, HypercertClaim, HypercertCollection, HypercertCollectionItem, HypercertContributionDetails, HypercertContributor, HypercertContributorInformation, HypercertEvaluation, HypercertEvents, HypercertEvidence, HypercertImage, HypercertImageRecord, HypercertLocation, HypercertMeasurement, HypercertOperations, HypercertProject, HypercertProjectWithMetadata, HypercertRights, HypercertWithMetadata, HypercertWorkScopeTag, ListParams, LoggerInterface, Organization, OrganizationInfo, OrganizationOperations, PaginatedList, ProfileOperations, ProgressStep, RecordOperations, RepositoryAccessGrant, RepositoryOptions, RepositoryRole, Session, SessionStore, StateStore, UpdateProjectParams, UpdateResult };
|