@hypercerts-org/lexicon 0.10.0-beta.0 → 0.10.0-beta.2

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.
Files changed (110) hide show
  1. package/README.md +126 -13
  2. package/dist/exports.d.ts +1018 -0
  3. package/dist/exports.d.ts.map +1 -0
  4. package/dist/generated/exports.d.ts +1018 -0
  5. package/dist/generated/exports.d.ts.map +1 -0
  6. package/dist/generated/lexicons.d.ts +1805 -0
  7. package/dist/generated/lexicons.d.ts.map +1 -0
  8. package/dist/generated/types/app/certified/badge/award.d.ts +24 -0
  9. package/dist/generated/types/app/certified/badge/award.d.ts.map +1 -0
  10. package/dist/generated/types/app/certified/badge/definition.d.ts +25 -0
  11. package/dist/generated/types/app/certified/badge/definition.d.ts.map +1 -0
  12. package/dist/generated/types/app/certified/badge/response.d.ts +20 -0
  13. package/dist/generated/types/app/certified/badge/response.d.ts.map +1 -0
  14. package/dist/generated/types/app/certified/defs.d.ts +3 -0
  15. package/dist/generated/types/app/certified/defs.d.ts.map +1 -0
  16. package/dist/generated/types/app/certified/location.d.ts +29 -0
  17. package/dist/generated/types/app/certified/location.d.ts.map +1 -0
  18. package/dist/generated/types/com/atproto/repo/strongRef.d.ts +12 -0
  19. package/dist/generated/types/com/atproto/repo/strongRef.d.ts.map +1 -0
  20. package/dist/generated/types/org/hypercerts/claim/activity.d.ts +57 -0
  21. package/dist/generated/types/org/hypercerts/claim/activity.d.ts.map +1 -0
  22. package/dist/generated/types/org/hypercerts/claim/collection.d.ts +25 -0
  23. package/dist/generated/types/org/hypercerts/claim/collection.d.ts.map +1 -0
  24. package/dist/generated/types/org/hypercerts/claim/contribution.d.ts +24 -0
  25. package/dist/generated/types/org/hypercerts/claim/contribution.d.ts.map +1 -0
  26. package/dist/generated/types/org/hypercerts/claim/evaluation.d.ts +43 -0
  27. package/dist/generated/types/org/hypercerts/claim/evaluation.d.ts.map +1 -0
  28. package/dist/generated/types/org/hypercerts/claim/evidence.d.ts +29 -0
  29. package/dist/generated/types/org/hypercerts/claim/evidence.d.ts.map +1 -0
  30. package/dist/generated/types/org/hypercerts/claim/measurement.d.ts +30 -0
  31. package/dist/generated/types/org/hypercerts/claim/measurement.d.ts.map +1 -0
  32. package/dist/generated/types/org/hypercerts/claim/project.d.ts +29 -0
  33. package/dist/generated/types/org/hypercerts/claim/project.d.ts.map +1 -0
  34. package/dist/generated/types/org/hypercerts/claim/rights.d.ts +25 -0
  35. package/dist/generated/types/org/hypercerts/claim/rights.d.ts.map +1 -0
  36. package/dist/generated/types/org/hypercerts/defs.d.ts +45 -0
  37. package/dist/generated/types/org/hypercerts/defs.d.ts.map +1 -0
  38. package/dist/generated/types/org/hypercerts/funding/receipt.d.ts +34 -0
  39. package/dist/generated/types/org/hypercerts/funding/receipt.d.ts.map +1 -0
  40. package/dist/generated/types/pub/leaflet/pages/linearDocument.d.ts +2 -0
  41. package/dist/generated/types/pub/leaflet/pages/linearDocument.d.ts.map +1 -0
  42. package/dist/generated/util.d.ts +37 -0
  43. package/dist/generated/util.d.ts.map +1 -0
  44. package/dist/index.cjs +2636 -0
  45. package/dist/index.cjs.map +1 -0
  46. package/dist/index.mjs +2560 -0
  47. package/dist/index.mjs.map +1 -0
  48. package/dist/lexicons.cjs +1002 -0
  49. package/dist/lexicons.cjs.map +1 -0
  50. package/dist/lexicons.d.ts +1805 -0
  51. package/dist/lexicons.d.ts.map +1 -0
  52. package/dist/lexicons.mjs +996 -0
  53. package/dist/lexicons.mjs.map +1 -0
  54. package/dist/types/app/certified/badge/award.d.ts +24 -0
  55. package/dist/types/app/certified/badge/award.d.ts.map +1 -0
  56. package/dist/types/app/certified/badge/definition.d.ts +25 -0
  57. package/dist/types/app/certified/badge/definition.d.ts.map +1 -0
  58. package/dist/types/app/certified/badge/response.d.ts +20 -0
  59. package/dist/types/app/certified/badge/response.d.ts.map +1 -0
  60. package/dist/types/app/certified/defs.d.ts +3 -0
  61. package/dist/types/app/certified/defs.d.ts.map +1 -0
  62. package/dist/types/app/certified/location.d.ts +29 -0
  63. package/dist/types/app/certified/location.d.ts.map +1 -0
  64. package/dist/types/com/atproto/repo/strongRef.d.ts +12 -0
  65. package/dist/types/com/atproto/repo/strongRef.d.ts.map +1 -0
  66. package/dist/types/org/hypercerts/claim/activity.d.ts +57 -0
  67. package/dist/types/org/hypercerts/claim/activity.d.ts.map +1 -0
  68. package/dist/types/org/hypercerts/claim/collection.d.ts +25 -0
  69. package/dist/types/org/hypercerts/claim/collection.d.ts.map +1 -0
  70. package/dist/types/org/hypercerts/claim/contribution.d.ts +24 -0
  71. package/dist/types/org/hypercerts/claim/contribution.d.ts.map +1 -0
  72. package/dist/types/org/hypercerts/claim/evaluation.d.ts +43 -0
  73. package/dist/types/org/hypercerts/claim/evaluation.d.ts.map +1 -0
  74. package/dist/types/org/hypercerts/claim/evidence.d.ts +29 -0
  75. package/dist/types/org/hypercerts/claim/evidence.d.ts.map +1 -0
  76. package/dist/types/org/hypercerts/claim/measurement.d.ts +30 -0
  77. package/dist/types/org/hypercerts/claim/measurement.d.ts.map +1 -0
  78. package/dist/types/org/hypercerts/claim/project.d.ts +29 -0
  79. package/dist/types/org/hypercerts/claim/project.d.ts.map +1 -0
  80. package/dist/types/org/hypercerts/claim/rights.d.ts +25 -0
  81. package/dist/types/org/hypercerts/claim/rights.d.ts.map +1 -0
  82. package/dist/types/org/hypercerts/defs.d.ts +45 -0
  83. package/dist/types/org/hypercerts/defs.d.ts.map +1 -0
  84. package/dist/types/org/hypercerts/funding/receipt.d.ts +34 -0
  85. package/dist/types/org/hypercerts/funding/receipt.d.ts.map +1 -0
  86. package/dist/types/pub/leaflet/pages/linearDocument.d.ts +2 -0
  87. package/dist/types/pub/leaflet/pages/linearDocument.d.ts.map +1 -0
  88. package/dist/util.d.ts +37 -0
  89. package/dist/util.d.ts.map +1 -0
  90. package/package.json +51 -21
  91. package/README.md.orig +0 -267
  92. package/types/index.ts +0 -1257
  93. package/types/lexicons.ts +0 -1071
  94. package/types/types/app/certified/badge/award.ts +0 -48
  95. package/types/types/app/certified/badge/definition.ts +0 -49
  96. package/types/types/app/certified/badge/response.ts +0 -44
  97. package/types/types/app/certified/defs.ts +0 -14
  98. package/types/types/app/certified/location.ts +0 -49
  99. package/types/types/com/atproto/repo/strongRef.ts +0 -31
  100. package/types/types/org/hypercerts/claim/activity.ts +0 -99
  101. package/types/types/org/hypercerts/claim/collection.ts +0 -49
  102. package/types/types/org/hypercerts/claim/contribution.ts +0 -48
  103. package/types/types/org/hypercerts/claim/evaluation.ts +0 -77
  104. package/types/types/org/hypercerts/claim/evidence.ts +0 -53
  105. package/types/types/org/hypercerts/claim/measurement.ts +0 -54
  106. package/types/types/org/hypercerts/claim/project.ts +0 -53
  107. package/types/types/org/hypercerts/claim/rights.ts +0 -49
  108. package/types/types/org/hypercerts/defs.ts +0 -96
  109. package/types/types/org/hypercerts/funding/receipt.ts +0 -58
  110. package/types/util.ts +0 -82
@@ -1,49 +0,0 @@
1
- /**
2
- * GENERATED CODE - DO NOT MODIFY
3
- */
4
- import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
- import { CID } from 'multiformats/cid'
6
- import { validate as _validate } from '../../../../lexicons'
7
- import {
8
- type $Typed,
9
- is$typed as _is$typed,
10
- type OmitKey,
11
- } from '../../../../util'
12
- import type * as OrgHypercertsDefs from '../defs.js'
13
-
14
- const is$typed = _is$typed,
15
- validate = _validate
16
- const id = 'org.hypercerts.claim.rights'
17
-
18
- export interface Main {
19
- $type: 'org.hypercerts.claim.rights'
20
- /** Full name of the rights */
21
- rightsName: string
22
- /** Short rights identifier for easier search */
23
- rightsType: string
24
- /** Description of the rights of this hypercert */
25
- rightsDescription: string
26
- attachment?:
27
- | $Typed<OrgHypercertsDefs.Uri>
28
- | $Typed<OrgHypercertsDefs.SmallBlob>
29
- | { $type: string }
30
- /** Client-declared timestamp when this record was originally created */
31
- createdAt: string
32
- [k: string]: unknown
33
- }
34
-
35
- const hashMain = 'main'
36
-
37
- export function isMain<V>(v: V) {
38
- return is$typed(v, id, hashMain)
39
- }
40
-
41
- export function validateMain<V>(v: V) {
42
- return validate<Main & V>(v, id, hashMain, true)
43
- }
44
-
45
- export {
46
- type Main as Record,
47
- isMain as isRecord,
48
- validateMain as validateRecord,
49
- }
@@ -1,96 +0,0 @@
1
- /**
2
- * GENERATED CODE - DO NOT MODIFY
3
- */
4
- import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
- import { CID } from 'multiformats/cid'
6
- import { validate as _validate } from '../../../lexicons'
7
- import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
8
-
9
- const is$typed = _is$typed,
10
- validate = _validate
11
- const id = 'org.hypercerts.defs'
12
-
13
- /** Object containing a URI to external data */
14
- export interface Uri {
15
- $type?: 'org.hypercerts.defs#uri'
16
- /** URI to external data */
17
- uri: string
18
- }
19
-
20
- const hashUri = 'uri'
21
-
22
- export function isUri<V>(v: V) {
23
- return is$typed(v, id, hashUri)
24
- }
25
-
26
- export function validateUri<V>(v: V) {
27
- return validate<Uri & V>(v, id, hashUri)
28
- }
29
-
30
- /** Object containing a blob to external data */
31
- export interface SmallBlob {
32
- $type?: 'org.hypercerts.defs#smallBlob'
33
- /** Blob to external data (up to 10MB) */
34
- blob: BlobRef
35
- }
36
-
37
- const hashSmallBlob = 'smallBlob'
38
-
39
- export function isSmallBlob<V>(v: V) {
40
- return is$typed(v, id, hashSmallBlob)
41
- }
42
-
43
- export function validateSmallBlob<V>(v: V) {
44
- return validate<SmallBlob & V>(v, id, hashSmallBlob)
45
- }
46
-
47
- /** Object containing a blob to external data */
48
- export interface LargeBlob {
49
- $type?: 'org.hypercerts.defs#largeBlob'
50
- /** Blob to external data (up to 100MB) */
51
- blob: BlobRef
52
- }
53
-
54
- const hashLargeBlob = 'largeBlob'
55
-
56
- export function isLargeBlob<V>(v: V) {
57
- return is$typed(v, id, hashLargeBlob)
58
- }
59
-
60
- export function validateLargeBlob<V>(v: V) {
61
- return validate<LargeBlob & V>(v, id, hashLargeBlob)
62
- }
63
-
64
- /** Object containing a small image */
65
- export interface SmallImage {
66
- $type?: 'org.hypercerts.defs#smallImage'
67
- /** Image (up to 5MB) */
68
- image: BlobRef
69
- }
70
-
71
- const hashSmallImage = 'smallImage'
72
-
73
- export function isSmallImage<V>(v: V) {
74
- return is$typed(v, id, hashSmallImage)
75
- }
76
-
77
- export function validateSmallImage<V>(v: V) {
78
- return validate<SmallImage & V>(v, id, hashSmallImage)
79
- }
80
-
81
- /** Object containing a large image */
82
- export interface LargeImage {
83
- $type?: 'org.hypercerts.defs#largeImage'
84
- /** Image (up to 10MB) */
85
- image: BlobRef
86
- }
87
-
88
- const hashLargeImage = 'largeImage'
89
-
90
- export function isLargeImage<V>(v: V) {
91
- return is$typed(v, id, hashLargeImage)
92
- }
93
-
94
- export function validateLargeImage<V>(v: V) {
95
- return validate<LargeImage & V>(v, id, hashLargeImage)
96
- }
@@ -1,58 +0,0 @@
1
- /**
2
- * GENERATED CODE - DO NOT MODIFY
3
- */
4
- import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
- import { CID } from 'multiformats/cid'
6
- import { validate as _validate } from '../../../../lexicons'
7
- import {
8
- type $Typed,
9
- is$typed as _is$typed,
10
- type OmitKey,
11
- } from '../../../../util'
12
- import type * as AppCertifiedDefs from '../../../app/certified/defs.js'
13
-
14
- const is$typed = _is$typed,
15
- validate = _validate
16
- const id = 'org.hypercerts.funding.receipt'
17
-
18
- export interface Main {
19
- $type: 'org.hypercerts.funding.receipt'
20
- from: AppCertifiedDefs.Did
21
- /** The recipient of the funds. Can be identified by DID or a clear-text name. */
22
- to: string
23
- /** Amount of funding received. */
24
- amount: string
25
- /** Currency of the payment (e.g. EUR, USD, ETH). */
26
- currency: string
27
- /** How the funds were transferred (e.g. bank_transfer, credit_card, onchain, cash, check, payment_processor). */
28
- paymentRail?: string
29
- /** Optional network within the payment rail (e.g. arbitrum, ethereum, sepa, visa, paypal). */
30
- paymentNetwork?: string
31
- /** Identifier of the underlying payment transaction (e.g. bank reference, onchain transaction hash, or processor-specific ID). Use paymentNetwork to specify the network where applicable. */
32
- transactionId?: string
33
- /** Optional reference to the activity, project, or organization this funding relates to. */
34
- for?: string
35
- /** Optional notes or additional context for this funding receipt. */
36
- notes?: string
37
- /** Timestamp when the payment occurred. */
38
- occurredAt?: string
39
- /** Client-declared timestamp when this receipt record was created. */
40
- createdAt: string
41
- [k: string]: unknown
42
- }
43
-
44
- const hashMain = 'main'
45
-
46
- export function isMain<V>(v: V) {
47
- return is$typed(v, id, hashMain)
48
- }
49
-
50
- export function validateMain<V>(v: V) {
51
- return validate<Main & V>(v, id, hashMain, true)
52
- }
53
-
54
- export {
55
- type Main as Record,
56
- isMain as isRecord,
57
- validateMain as validateRecord,
58
- }
package/types/util.ts DELETED
@@ -1,82 +0,0 @@
1
- /**
2
- * GENERATED CODE - DO NOT MODIFY
3
- */
4
-
5
- import { type ValidationResult } from '@atproto/lexicon'
6
-
7
- export type OmitKey<T, K extends keyof T> = {
8
- [K2 in keyof T as K2 extends K ? never : K2]: T[K2]
9
- }
10
-
11
- export type $Typed<V, T extends string = string> = V & { $type: T }
12
- export type Un$Typed<V extends { $type?: string }> = OmitKey<V, '$type'>
13
-
14
- export type $Type<Id extends string, Hash extends string> = Hash extends 'main'
15
- ? Id
16
- : `${Id}#${Hash}`
17
-
18
- function isObject<V>(v: V): v is V & object {
19
- return v != null && typeof v === 'object'
20
- }
21
-
22
- function is$type<Id extends string, Hash extends string>(
23
- $type: unknown,
24
- id: Id,
25
- hash: Hash,
26
- ): $type is $Type<Id, Hash> {
27
- return hash === 'main'
28
- ? $type === id
29
- : // $type === `${id}#${hash}`
30
- typeof $type === 'string' &&
31
- $type.length === id.length + 1 + hash.length &&
32
- $type.charCodeAt(id.length) === 35 /* '#' */ &&
33
- $type.startsWith(id) &&
34
- $type.endsWith(hash)
35
- }
36
-
37
- export type $TypedObject<
38
- V,
39
- Id extends string,
40
- Hash extends string,
41
- > = V extends {
42
- $type: $Type<Id, Hash>
43
- }
44
- ? V
45
- : V extends { $type?: string }
46
- ? V extends { $type?: infer T extends $Type<Id, Hash> }
47
- ? V & { $type: T }
48
- : never
49
- : V & { $type: $Type<Id, Hash> }
50
-
51
- export function is$typed<V, Id extends string, Hash extends string>(
52
- v: V,
53
- id: Id,
54
- hash: Hash,
55
- ): v is $TypedObject<V, Id, Hash> {
56
- return isObject(v) && '$type' in v && is$type(v.$type, id, hash)
57
- }
58
-
59
- export function maybe$typed<V, Id extends string, Hash extends string>(
60
- v: V,
61
- id: Id,
62
- hash: Hash,
63
- ): v is V & object & { $type?: $Type<Id, Hash> } {
64
- return (
65
- isObject(v) &&
66
- ('$type' in v ? v.$type === undefined || is$type(v.$type, id, hash) : true)
67
- )
68
- }
69
-
70
- export type Validator<R = unknown> = (v: unknown) => ValidationResult<R>
71
- export type ValidatorParam<V extends Validator> =
72
- V extends Validator<infer R> ? R : never
73
-
74
- /**
75
- * Utility function that allows to convert a "validate*" utility function into a
76
- * type predicate.
77
- */
78
- export function asPredicate<V extends Validator>(validate: V) {
79
- return function <T>(v: T): v is T & ValidatorParam<V> {
80
- return validate(v).success
81
- }
82
- }