techne-sdk 0.12.0 → 0.13.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/CHANGELOG.md +40 -0
- package/dist/auth/placement.gen.d.ts +1 -1
- package/dist/auth/placement.gen.js +3 -0
- package/dist/catalog/catalog.gen.d.ts +22 -0
- package/dist/catalog/catalog.gen.js +1522 -44
- package/dist/generated/index.d.ts +141 -0
- package/dist/generated/index.js +186 -0
- package/dist/generated/lexicons.d.ts +840 -54
- package/dist/generated/lexicons.js +466 -18
- package/dist/generated/nsid.d.ts +41 -0
- package/dist/generated/nsid.js +41 -0
- package/dist/generated/nsid.json +41 -0
- package/dist/generated/records.d.ts +134 -124
- package/dist/generated/types/pub/techne/draft/beaconSpotV2.d.ts +23 -0
- package/dist/generated/types/pub/techne/draft/beaconSpotV2.js +12 -0
- package/dist/generated/types/pub/techne/draft/collectiveV2.d.ts +31 -0
- package/dist/generated/types/pub/techne/draft/collectiveV2.js +12 -0
- package/dist/generated/types/pub/techne/draft/locationEntry.d.ts +23 -0
- package/dist/generated/types/pub/techne/draft/locationEntry.js +11 -0
- package/dist/generated/types/pub/techne/draft/org.d.ts +6 -4
- package/dist/generated/types/pub/techne/draft/pendingBeaconSpotV2.d.ts +24 -0
- package/dist/generated/types/pub/techne/draft/pendingBeaconSpotV2.js +12 -0
- package/dist/generated/types/pub/techne/draft/placeV2.d.ts +42 -0
- package/dist/generated/types/pub/techne/draft/placeV2.js +12 -0
- package/dist/generated/types/pub/techne/draft/query/composeRecords.d.ts +6 -2
- package/dist/generated/types/pub/techne/draft/query/countRecords.d.ts +2 -0
- package/dist/generated/types/pub/techne/draft/query/listRecords.d.ts +34 -0
- package/dist/generated/types/pub/techne/draft/query/listRecords.js +14 -0
- package/dist/generated/types/pub/techne/draft/region.d.ts +20 -0
- package/dist/generated/types/pub/techne/draft/region.js +12 -0
- package/dist/generated/types/pub/techne/draft/statement.d.ts +15 -1
- package/dist/generated/types/pub/techne/draft/statement.js +7 -0
- package/dist/query/compose.d.ts +2 -2
- package/dist/query/compose.js +1 -1
- package/dist/query/index.d.ts +19 -1
- package/dist/query/index.js +2 -0
- package/dist/wasm/techne-wasm.gen.js +1 -1
- package/dist/wasm/techne-wasm2js.gen.js +20452 -20454
- package/package.json +1 -1
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { HeadersMap, XRPCError } from '@atproto/xrpc';
|
|
5
5
|
import { type ValidationResult } from '@atproto/lexicon';
|
|
6
|
+
import { type $Typed } from '../../../../../util.js';
|
|
7
|
+
import type * as CommunityLexiconLocationGeo from '../../../../community/lexicon/location/geo.js';
|
|
8
|
+
import type * as CommunityLexiconLocationHthree from '../../../../community/lexicon/location/hthree.js';
|
|
9
|
+
import type * as CommunityLexiconLocationAddress from '../../../../community/lexicon/location/address.js';
|
|
10
|
+
import type * as ComAtprotoRepoStrongRef from '../../../../com/atproto/repo/strongRef.js';
|
|
11
|
+
import type * as PubTechneDraftLocationEntry from '../locationEntry.js';
|
|
6
12
|
export type QueryParams = {
|
|
7
13
|
/** A pub.techne.draft.query object, as JSON. Give this or `queryUri`. */
|
|
8
14
|
query?: string;
|
|
@@ -27,6 +33,7 @@ export interface OutputSchema {
|
|
|
27
33
|
count?: number;
|
|
28
34
|
/** Only when asked with `count=true`: true when there are more than `count` (countRecords' `capped`). */
|
|
29
35
|
capped?: boolean;
|
|
36
|
+
notServedHere?: NotServedHere;
|
|
30
37
|
}
|
|
31
38
|
export interface CallOptions {
|
|
32
39
|
signal?: AbortSignal;
|
|
@@ -80,6 +87,33 @@ export interface Record {
|
|
|
80
87
|
signals?: {
|
|
81
88
|
[_ in string]: unknown;
|
|
82
89
|
};
|
|
90
|
+
/** With a `location` `in` or `covers` condition: the stated locations that matched (with `followed`, its subject's), at most 8. */
|
|
91
|
+
matched?: MatchedLocation[];
|
|
83
92
|
}
|
|
84
93
|
export declare function isRecord<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.query.listRecords", "record">;
|
|
85
94
|
export declare function validateRecord<V>(v: V): ValidationResult<Record & V>;
|
|
95
|
+
/** One stated location that matched. */
|
|
96
|
+
export interface MatchedLocation {
|
|
97
|
+
$type?: 'pub.techne.draft.query.listRecords#matchedLocation';
|
|
98
|
+
entry?: $Typed<CommunityLexiconLocationGeo.Main> | $Typed<CommunityLexiconLocationHthree.Main> | $Typed<CommunityLexiconLocationAddress.Main> | $Typed<ComAtprotoRepoStrongRef.Main> | $Typed<PubTechneDraftLocationEntry.Main> | {
|
|
99
|
+
$type: string;
|
|
100
|
+
};
|
|
101
|
+
/** How the thing relates to the place (`at`, `serves`, `registered`, ...). */
|
|
102
|
+
kind: string;
|
|
103
|
+
/** Who stated it: the record's author, or a claim's writer. */
|
|
104
|
+
asserter: string;
|
|
105
|
+
/** The record that stated it (the record itself, or a claim about it). */
|
|
106
|
+
source: string;
|
|
107
|
+
}
|
|
108
|
+
export declare function isMatchedLocation<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.query.listRecords", "matchedLocation">;
|
|
109
|
+
export declare function validateMatchedLocation<V>(v: V): ValidationResult<MatchedLocation & V>;
|
|
110
|
+
/** Why the answer is not the whole answer: this operator does not serve the place asked about. An empty list (or a zero count) with this set means "not served here", not "nothing there". */
|
|
111
|
+
export interface NotServedHere {
|
|
112
|
+
$type?: 'pub.techne.draft.query.listRecords#notServedHere';
|
|
113
|
+
/** `outsideCoverage`: a `near` or `covers` point lies outside the areas this operator serves. `areaNotHeld`: an `in` area is one this operator does not hold, or lies outside the areas it serves. */
|
|
114
|
+
reason: 'outsideCoverage' | 'areaNotHeld' | (string & {});
|
|
115
|
+
/** The reason, in words, for a person to read. */
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
export declare function isNotServedHere<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.query.listRecords", "notServedHere">;
|
|
119
|
+
export declare function validateNotServedHere<V>(v: V): ValidationResult<NotServedHere & V>;
|
|
@@ -46,3 +46,17 @@ export function isRecord(v) {
|
|
|
46
46
|
export function validateRecord(v) {
|
|
47
47
|
return validate(v, id, hashRecord);
|
|
48
48
|
}
|
|
49
|
+
const hashMatchedLocation = 'matchedLocation';
|
|
50
|
+
export function isMatchedLocation(v) {
|
|
51
|
+
return is$typed(v, id, hashMatchedLocation);
|
|
52
|
+
}
|
|
53
|
+
export function validateMatchedLocation(v) {
|
|
54
|
+
return validate(v, id, hashMatchedLocation);
|
|
55
|
+
}
|
|
56
|
+
const hashNotServedHere = 'notServedHere';
|
|
57
|
+
export function isNotServedHere(v) {
|
|
58
|
+
return is$typed(v, id, hashNotServedHere);
|
|
59
|
+
}
|
|
60
|
+
export function validateNotServedHere(v) {
|
|
61
|
+
return validate(v, id, hashNotServedHere);
|
|
62
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { type ValidationResult } from '@atproto/lexicon';
|
|
5
|
+
import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js';
|
|
6
|
+
export interface Main {
|
|
7
|
+
$type: 'pub.techne.draft.region';
|
|
8
|
+
area: ComAtprotoRepoStrongRef.Main;
|
|
9
|
+
/** The operator that holds the region: the DID of the account that runs its AppView. Its endpoint is a fact about the operator and is not stored here. */
|
|
10
|
+
operator: string;
|
|
11
|
+
/** When the period starts. Absent: from always. */
|
|
12
|
+
validFrom?: string;
|
|
13
|
+
/** When the period ends (exclusive). Absent: it has not ended. */
|
|
14
|
+
validUntil?: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare function isMain<V>(v: V): v is import("../../../../util.js").$TypedObject<V, "pub.techne.draft.region", "main">;
|
|
19
|
+
export declare function validateMain<V>(v: V): ValidationResult<Main & V>;
|
|
20
|
+
export { type Main as Record, isMain as isRecord, validateMain as validateRecord, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { validate as _validate } from '../../../../lexicons.js';
|
|
2
|
+
import { is$typed as _is$typed, } from '../../../../util.js';
|
|
3
|
+
const is$typed = _is$typed, validate = _validate;
|
|
4
|
+
const id = 'pub.techne.draft.region';
|
|
5
|
+
const hashMain = 'main';
|
|
6
|
+
export function isMain(v) {
|
|
7
|
+
return is$typed(v, id, hashMain);
|
|
8
|
+
}
|
|
9
|
+
export function validateMain(v) {
|
|
10
|
+
return validate(v, id, hashMain, true);
|
|
11
|
+
}
|
|
12
|
+
export { isMain as isRecord, validateMain as validateRecord, };
|
|
@@ -5,10 +5,14 @@ import { type ValidationResult } from '@atproto/lexicon';
|
|
|
5
5
|
import { type $Typed } from '../../../../util.js';
|
|
6
6
|
import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js';
|
|
7
7
|
import type * as PubTechneDraftOrg from './org.js';
|
|
8
|
+
import type * as CommunityLexiconLocationGeo from '../../../community/lexicon/location/geo.js';
|
|
9
|
+
import type * as CommunityLexiconLocationHthree from '../../../community/lexicon/location/hthree.js';
|
|
10
|
+
import type * as CommunityLexiconLocationAddress from '../../../community/lexicon/location/address.js';
|
|
11
|
+
import type * as PubTechneDraftLocationEntry from './locationEntry.js';
|
|
8
12
|
export interface Main {
|
|
9
13
|
$type: 'pub.techne.draft.statement';
|
|
10
14
|
subject: ComAtprotoRepoStrongRef.Main;
|
|
11
|
-
fields: $Typed<PubTechneDraftOrg.Fields> | {
|
|
15
|
+
fields: $Typed<PubTechneDraftOrg.Fields> | $Typed<Locations> | {
|
|
12
16
|
$type: string;
|
|
13
17
|
};
|
|
14
18
|
createdAt: string;
|
|
@@ -17,3 +21,13 @@ export interface Main {
|
|
|
17
21
|
export declare function isMain<V>(v: V): v is import("../../../../util.js").$TypedObject<V, "pub.techne.draft.statement", "main">;
|
|
18
22
|
export declare function validateMain<V>(v: V): ValidationResult<Main & V>;
|
|
19
23
|
export { type Main as Record, isMain as isRecord, validateMain as validateRecord, };
|
|
24
|
+
/** Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses. */
|
|
25
|
+
export interface Locations {
|
|
26
|
+
$type?: 'pub.techne.draft.statement#locations';
|
|
27
|
+
/** Entries as in the subject's own `locations` field (lexicon naming register). */
|
|
28
|
+
locations: ($Typed<CommunityLexiconLocationGeo.Main> | $Typed<CommunityLexiconLocationHthree.Main> | $Typed<CommunityLexiconLocationAddress.Main> | $Typed<ComAtprotoRepoStrongRef.Main> | $Typed<PubTechneDraftLocationEntry.Main> | {
|
|
29
|
+
$type: string;
|
|
30
|
+
})[];
|
|
31
|
+
}
|
|
32
|
+
export declare function isLocations<V>(v: V): v is import("../../../../util.js").$TypedObject<V, "pub.techne.draft.statement", "locations">;
|
|
33
|
+
export declare function validateLocations<V>(v: V): ValidationResult<Locations & V>;
|
|
@@ -10,3 +10,10 @@ export function validateMain(v) {
|
|
|
10
10
|
return validate(v, id, hashMain, true);
|
|
11
11
|
}
|
|
12
12
|
export { isMain as isRecord, validateMain as validateRecord, };
|
|
13
|
+
const hashLocations = 'locations';
|
|
14
|
+
export function isLocations(v) {
|
|
15
|
+
return is$typed(v, id, hashLocations);
|
|
16
|
+
}
|
|
17
|
+
export function validateLocations(v) {
|
|
18
|
+
return validate(v, id, hashLocations);
|
|
19
|
+
}
|
package/dist/query/compose.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const COMPOSE_RETRIES = 2;
|
|
|
75
75
|
export declare const ENVELOPE_ONLY: readonly string[];
|
|
76
76
|
/** The record fields a step's `envelope` may keep besides `uri` (kept unless the step asks `uri: false`) and
|
|
77
77
|
* `value` (always kept). */
|
|
78
|
-
export declare const ENVELOPE_FIELDS: readonly ["cid", "author", "collection", "time", "space", "source", "curated", "held", "measures", "signals"];
|
|
78
|
+
export declare const ENVELOPE_FIELDS: readonly ["cid", "author", "collection", "time", "space", "source", "curated", "held", "measures", "signals", "matched"];
|
|
79
79
|
export type EnvelopeField = (typeof ENVELOPE_FIELDS)[number];
|
|
80
80
|
declare const envelopeOf: unique symbol;
|
|
81
81
|
declare const uriOf: unique symbol;
|
|
@@ -87,7 +87,7 @@ type KeptUri<U extends boolean> = [U] extends [true] ? 'uri' : never;
|
|
|
87
87
|
* `E` is every field: listRecords' record.
|
|
88
88
|
* It carries the same marker as {@link StepRef}: a record kept with more fields stands in for one needing fewer,
|
|
89
89
|
* never the other way, even when the field left out is optional (`space`, `curated`, `held`, `measures`,
|
|
90
|
-
* `signals`), which `Pick` alone would let through. A whole {@link QueryRecord} (no marker) stands in for any. */
|
|
90
|
+
* `signals`, `matched`), which `Pick` alone would let through. A whole {@link QueryRecord} (no marker) stands in for any. */
|
|
91
91
|
export type StepRecord<V = Record<string, unknown>, E extends EnvelopeField = EnvelopeField, U extends boolean = true> = Pick<QueryRecord<V>, KeptUri<U> | 'value' | E> & {
|
|
92
92
|
/** Type only, never set: the record fields the step kept. */
|
|
93
93
|
readonly [envelopeOf]?: (field: E) => void;
|
package/dist/query/compose.js
CHANGED
|
@@ -70,7 +70,7 @@ export const COMPOSE_RETRIES = 2;
|
|
|
70
70
|
export const ENVELOPE_ONLY = ['_'];
|
|
71
71
|
/** The record fields a step's `envelope` may keep besides `uri` (kept unless the step asks `uri: false`) and
|
|
72
72
|
* `value` (always kept). */
|
|
73
|
-
export const ENVELOPE_FIELDS = ['cid', 'author', 'collection', 'time', 'space', 'source', 'curated', 'held', 'measures', 'signals'];
|
|
73
|
+
export const ENVELOPE_FIELDS = ['cid', 'author', 'collection', 'time', 'space', 'source', 'curated', 'held', 'measures', 'signals', 'matched'];
|
|
74
74
|
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
75
75
|
/** `e` as a {@link StepError} when it is one; `undefined` otherwise. */
|
|
76
76
|
function stepErrorOf(e) {
|
package/dist/query/index.d.ts
CHANGED
|
@@ -13,11 +13,14 @@
|
|
|
13
13
|
* `get(nsid, params)` over whatever session it has. What a record means stays the app's.
|
|
14
14
|
*/
|
|
15
15
|
import type * as GetRecords from '../generated/types/pub/techne/draft/query/getRecords.js';
|
|
16
|
+
import type * as ListRecords from '../generated/types/pub/techne/draft/query/listRecords.js';
|
|
16
17
|
/** A `$param` value: a string, or a list of strings where the query says `in`. */
|
|
17
18
|
export type Param = string | readonly string[];
|
|
18
19
|
/** The one call this module makes: a GET of a platform method. A list value is sent repeated. */
|
|
19
20
|
export type QueryReader = <T>(nsid: string, params: Record<string, string | number | readonly string[] | undefined>) => Promise<T>;
|
|
20
|
-
/** One condition on a role (`{ "is": … }`, `{ "near": { point, within }, "as": … }`, …).
|
|
21
|
+
/** One condition on a role (`{ "is": … }`, `{ "near": { point, within }, "as": … }`, …). On `location`, `in` (a list
|
|
22
|
+
* of area URIs) and `covers` (a point), each with `kind` and `followed`, answer each record's
|
|
23
|
+
* {@link QueryRecord.matched}. */
|
|
21
24
|
export type Condition = Readonly<Record<string, unknown>>;
|
|
22
25
|
/** `has`: some public record the caller may read names this one through the role `via` (`subject`), by this
|
|
23
26
|
* record's own author when `by: 'author'`, and matches `where` (type and author conditions, `is`/`in`, alone or
|
|
@@ -100,7 +103,16 @@ export interface QueryRecord<V = Record<string, unknown>> {
|
|
|
100
103
|
/** The numbers the query's operators produced, by name (a `near` distance in metres). */
|
|
101
104
|
measures?: Record<string, number>;
|
|
102
105
|
signals?: Record<string, number>;
|
|
106
|
+
/** With a `location` `in` or `covers` condition: the stated locations that matched (with `followed`, its
|
|
107
|
+
* subject's), at most 8. */
|
|
108
|
+
matched?: MatchedLocation[];
|
|
103
109
|
}
|
|
110
|
+
/** One stated location a `location` `in` or `covers` condition matched (`listRecords#matchedLocation`). */
|
|
111
|
+
export type MatchedLocation = Omit<ListRecords.MatchedLocation, '$type'>;
|
|
112
|
+
/** The query asked about a place this platform does not serve (`listRecords#notServedHere`): an empty list or a
|
|
113
|
+
* zero count with it means "not served here", not "nothing there". `reason` is `outsideCoverage` (a `near` or
|
|
114
|
+
* `covers` point outside the areas served) or `areaNotHeld` (an `in` area not held, or outside them). */
|
|
115
|
+
export type NotServedHere = Omit<ListRecords.NotServedHere, '$type'>;
|
|
104
116
|
export interface ListPage<V = Record<string, unknown>> {
|
|
105
117
|
records: QueryRecord<V>[];
|
|
106
118
|
cursor?: string;
|
|
@@ -108,6 +120,8 @@ export interface ListPage<V = Record<string, unknown>> {
|
|
|
108
120
|
count?: number;
|
|
109
121
|
/** Asked with `count`: counting stopped at the platform's cap. */
|
|
110
122
|
capped?: boolean;
|
|
123
|
+
/** The query asked about a place this platform does not serve. */
|
|
124
|
+
notServedHere?: NotServedHere;
|
|
111
125
|
}
|
|
112
126
|
/** The most records one `listRecords` page carries (the lexicon's `limit` maximum). */
|
|
113
127
|
export declare const MAX_PAGE = 500;
|
|
@@ -156,6 +170,8 @@ export declare function batches<T>(list: readonly T[], fixed?: number): T[][];
|
|
|
156
170
|
* Every page of `query`, in its order. The query is the bound (the platform proves each branch
|
|
157
171
|
* index-driven); {@link MAX_PAGES} is only a guard. A page can hold fewer records than its limit and still carry
|
|
158
172
|
* a cursor (the platform's read rule drops some after reading), so paging stops only when none comes back.
|
|
173
|
+
* Records only: a page's `notServedHere` is not carried, so read a location query that may fall outside this
|
|
174
|
+
* platform's areas with {@link listRecords}.
|
|
159
175
|
*/
|
|
160
176
|
export declare function listAllRecords<V = Record<string, unknown>>(read: QueryReader, query: Query, call?: Omit<ListCall, 'cursor'>): Promise<QueryRecord<V>[]>;
|
|
161
177
|
/**
|
|
@@ -172,6 +188,8 @@ export interface CountAnswer {
|
|
|
172
188
|
key: string;
|
|
173
189
|
count: number;
|
|
174
190
|
}[];
|
|
191
|
+
/** The query asked about a place this platform does not serve: a zero count means not served, not none. */
|
|
192
|
+
notServedHere?: NotServedHere;
|
|
175
193
|
}
|
|
176
194
|
/** How many records `listRecords` would answer for `query`, optionally per type or author. */
|
|
177
195
|
export declare function countRecords(read: QueryReader, query: Query, call?: {
|
package/dist/query/index.js
CHANGED
|
@@ -96,6 +96,8 @@ export function batches(list, fixed = 0) {
|
|
|
96
96
|
* Every page of `query`, in its order. The query is the bound (the platform proves each branch
|
|
97
97
|
* index-driven); {@link MAX_PAGES} is only a guard. A page can hold fewer records than its limit and still carry
|
|
98
98
|
* a cursor (the platform's read rule drops some after reading), so paging stops only when none comes back.
|
|
99
|
+
* Records only: a page's `notServedHere` is not carried, so read a location query that may fall outside this
|
|
100
|
+
* platform's areas with {@link listRecords}.
|
|
99
101
|
*/
|
|
100
102
|
export async function listAllRecords(read, query, call = {}) {
|
|
101
103
|
const out = [];
|