techne-sdk 0.1.0 → 0.3.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +48 -2
  3. package/dist/auth/app-key.d.ts +8 -0
  4. package/dist/auth/app-key.js +95 -0
  5. package/dist/auth/index.d.ts +192 -0
  6. package/dist/auth/index.js +230 -0
  7. package/dist/auth/placement.gen.d.ts +1 -0
  8. package/dist/auth/placement.gen.js +50 -0
  9. package/dist/catalog/catalog.gen.js +2161 -681
  10. package/dist/connect.js +2 -1
  11. package/dist/generated/index.d.ts +61 -0
  12. package/dist/generated/index.js +116 -0
  13. package/dist/generated/lexicons.d.ts +3689 -1449
  14. package/dist/generated/lexicons.js +1237 -42
  15. package/dist/generated/nsid.d.ts +23 -1
  16. package/dist/generated/nsid.js +23 -19
  17. package/dist/generated/nsid.json +23 -19
  18. package/dist/generated/records.d.ts +28 -26
  19. package/dist/generated/types/pub/techne/draft/commons/getVersions.d.ts +3 -3
  20. package/dist/generated/types/pub/techne/draft/commons/runChain.d.ts +1 -1
  21. package/dist/generated/types/pub/techne/draft/credential.d.ts +1 -1
  22. package/dist/generated/types/pub/techne/draft/credentialRevocation.d.ts +1 -1
  23. package/dist/generated/types/pub/techne/draft/permissioned/deleteRecord.d.ts +5 -0
  24. package/dist/generated/types/pub/techne/draft/permissioned/deleteRecord.js +7 -0
  25. package/dist/generated/types/pub/techne/draft/permissioned/getRecord.d.ts +2 -1
  26. package/dist/generated/types/pub/techne/draft/permissioned/listChanges.d.ts +1 -1
  27. package/dist/generated/types/pub/techne/draft/permissioned/putRecord.d.ts +2 -2
  28. package/dist/generated/types/pub/techne/draft/provenance.d.ts +1 -1
  29. package/dist/generated/types/pub/techne/draft/publisher.d.ts +1 -1
  30. package/dist/generated/types/pub/techne/draft/query/composeRecords.d.ts +152 -0
  31. package/dist/generated/types/pub/techne/draft/query/composeRecords.js +55 -0
  32. package/dist/generated/types/pub/techne/draft/query/getRecords.d.ts +1 -1
  33. package/dist/generated/types/pub/techne/draft/query/listRecords.d.ts +0 -4
  34. package/dist/generated/types/pub/techne/draft/query/listRejections.d.ts +2 -2
  35. package/dist/generated/types/pub/techne/draft/registry/blockIndex.d.ts +42 -0
  36. package/dist/generated/types/pub/techne/draft/registry/blockIndex.js +34 -0
  37. package/dist/generated/types/pub/techne/draft/registry/defs.d.ts +112 -0
  38. package/dist/generated/types/pub/techne/draft/registry/defs.js +32 -0
  39. package/dist/generated/types/pub/techne/draft/registry/getType.d.ts +23 -0
  40. package/dist/generated/types/pub/techne/draft/registry/getType.js +20 -0
  41. package/dist/generated/types/pub/techne/draft/registry/getTypeRequest.d.ts +23 -0
  42. package/dist/generated/types/pub/techne/draft/registry/getTypeRequest.js +20 -0
  43. package/dist/generated/types/pub/techne/draft/registry/listTypeRequests.d.ts +27 -0
  44. package/dist/generated/types/pub/techne/draft/registry/listTypeRequests.js +7 -0
  45. package/dist/generated/types/pub/techne/draft/registry/listTypes.d.ts +34 -0
  46. package/dist/generated/types/pub/techne/draft/registry/listTypes.js +7 -0
  47. package/dist/generated/types/pub/techne/draft/registry/publishType.d.ts +77 -0
  48. package/dist/generated/types/pub/techne/draft/registry/publishType.js +83 -0
  49. package/dist/generated/types/pub/techne/draft/registry/purgeType.d.ts +39 -0
  50. package/dist/generated/types/pub/techne/draft/registry/purgeType.js +34 -0
  51. package/dist/generated/types/pub/techne/draft/registry/requestType.d.ts +53 -0
  52. package/dist/generated/types/pub/techne/draft/registry/requestType.js +76 -0
  53. package/dist/generated/types/pub/techne/draft/registry/typeRequest.d.ts +22 -0
  54. package/dist/generated/types/pub/techne/draft/registry/typeRequest.js +12 -0
  55. package/dist/generated/types/pub/techne/draft/sync/indexRecord.d.ts +1 -1
  56. package/dist/generated/types/pub/techne/draft/verdict.d.ts +2 -2
  57. package/dist/platform.d.ts +14 -0
  58. package/dist/platform.js +16 -0
  59. package/dist/put/index.js +17 -7
  60. package/dist/query/index.d.ts +1 -10
  61. package/dist/query/index.js +1 -1
  62. package/dist/types-cli/emit.d.ts +20 -0
  63. package/dist/types-cli/emit.js +217 -0
  64. package/dist/types-cli/main.d.ts +5 -0
  65. package/dist/types-cli/main.js +63 -0
  66. package/dist/types-cli/resolve.d.ts +26 -0
  67. package/dist/types-cli/resolve.js +99 -0
  68. package/dist/wasm/index.d.ts +20 -3
  69. package/dist/wasm/index.js +6 -1
  70. package/dist/wasm/techne-wasm.gen.js +1 -1
  71. package/dist/wasm/techne-wasm2js.gen.js +26425 -25985
  72. package/package.json +23 -6
@@ -0,0 +1,77 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { HeadersMap, XRPCError } from '@atproto/xrpc';
5
+ import type * as ComAtprotoRepoStrongRef from '../../../../com/atproto/repo/strongRef.js';
6
+ export type QueryParams = {};
7
+ export interface InputSchema {
8
+ /** The type to publish a new version of. Leave it out to create a type. */
9
+ nsid?: string;
10
+ /** For a new type, its name: the NSID's last segment, a letter then letters and digits (`bookClubMeeting`). With `nsid`, a new name under the same id (a second type, or a sidecar, of yours). */
11
+ name?: string;
12
+ /** The lexicon document. Its main def is a record. Its `id` may be left out of a new type (it is filled in); otherwise it must equal the type's NSID. */
13
+ lexicon: {
14
+ [_ in string]: unknown;
15
+ };
16
+ /** The type's `{nsid}.query` document: which fields fill the shared query roles (`start`, `end`, `location`, `text`, `references`, `category`; pub.techne.draft.query#roles). Without it the type's records can only be got and listed. */
17
+ query?: {
18
+ [_ in string]: unknown;
19
+ };
20
+ /** For a new type: the type it extends. Its main record must then have a required `subject` (an at-uri). */
21
+ sidecarOf?: string;
22
+ /** For a new type: the community type it was forked from. */
23
+ forkOf?: string;
24
+ }
25
+ export interface OutputSchema {
26
+ nsid: string;
27
+ version: number;
28
+ schema: ComAtprotoRepoStrongRef.Main;
29
+ /** The type's page on techne.pub. */
30
+ page: string;
31
+ /** Whether this call created the type (false: a new version). */
32
+ created: boolean;
33
+ /** The lexicon and query document equal the current version; nothing was published. */
34
+ unchanged?: boolean;
35
+ }
36
+ export interface CallOptions {
37
+ signal?: AbortSignal;
38
+ headers?: HeadersMap;
39
+ qp?: QueryParams;
40
+ encoding?: 'application/json';
41
+ }
42
+ export interface Response {
43
+ success: boolean;
44
+ headers: HeadersMap;
45
+ data: OutputSchema;
46
+ }
47
+ export declare class AuthenticationRequiredError extends XRPCError {
48
+ constructor(src: XRPCError);
49
+ }
50
+ export declare class InvalidLexiconError extends XRPCError {
51
+ constructor(src: XRPCError);
52
+ }
53
+ export declare class InvalidQueryError extends XRPCError {
54
+ constructor(src: XRPCError);
55
+ }
56
+ export declare class InvalidNameError extends XRPCError {
57
+ constructor(src: XRPCError);
58
+ }
59
+ export declare class NotAdditiveError extends XRPCError {
60
+ constructor(src: XRPCError);
61
+ }
62
+ export declare class NotCreatorError extends XRPCError {
63
+ constructor(src: XRPCError);
64
+ }
65
+ export declare class UnknownTypeError extends XRPCError {
66
+ constructor(src: XRPCError);
67
+ }
68
+ export declare class TooLargeError extends XRPCError {
69
+ constructor(src: XRPCError);
70
+ }
71
+ export declare class NotConfiguredError extends XRPCError {
72
+ constructor(src: XRPCError);
73
+ }
74
+ export declare class RateLimitExceededError extends XRPCError {
75
+ constructor(src: XRPCError);
76
+ }
77
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { XRPCError } from '@atproto/xrpc';
5
+ import { validate as _validate } from '../../../../../lexicons.js';
6
+ import { is$typed as _is$typed, } from '../../../../../util.js';
7
+ const is$typed = _is$typed, validate = _validate;
8
+ const id = 'pub.techne.draft.registry.publishType';
9
+ export class AuthenticationRequiredError extends XRPCError {
10
+ constructor(src) {
11
+ super(src.status, src.error, src.message, src.headers, { cause: src });
12
+ }
13
+ }
14
+ export class InvalidLexiconError extends XRPCError {
15
+ constructor(src) {
16
+ super(src.status, src.error, src.message, src.headers, { cause: src });
17
+ }
18
+ }
19
+ export class InvalidQueryError extends XRPCError {
20
+ constructor(src) {
21
+ super(src.status, src.error, src.message, src.headers, { cause: src });
22
+ }
23
+ }
24
+ export class InvalidNameError extends XRPCError {
25
+ constructor(src) {
26
+ super(src.status, src.error, src.message, src.headers, { cause: src });
27
+ }
28
+ }
29
+ export class NotAdditiveError extends XRPCError {
30
+ constructor(src) {
31
+ super(src.status, src.error, src.message, src.headers, { cause: src });
32
+ }
33
+ }
34
+ export class NotCreatorError extends XRPCError {
35
+ constructor(src) {
36
+ super(src.status, src.error, src.message, src.headers, { cause: src });
37
+ }
38
+ }
39
+ export class UnknownTypeError extends XRPCError {
40
+ constructor(src) {
41
+ super(src.status, src.error, src.message, src.headers, { cause: src });
42
+ }
43
+ }
44
+ export class TooLargeError extends XRPCError {
45
+ constructor(src) {
46
+ super(src.status, src.error, src.message, src.headers, { cause: src });
47
+ }
48
+ }
49
+ export class NotConfiguredError extends XRPCError {
50
+ constructor(src) {
51
+ super(src.status, src.error, src.message, src.headers, { cause: src });
52
+ }
53
+ }
54
+ export class RateLimitExceededError extends XRPCError {
55
+ constructor(src) {
56
+ super(src.status, src.error, src.message, src.headers, { cause: src });
57
+ }
58
+ }
59
+ export function toKnownErr(e) {
60
+ if (e instanceof XRPCError) {
61
+ if (e.error === 'AuthenticationRequired')
62
+ return new AuthenticationRequiredError(e);
63
+ if (e.error === 'InvalidLexicon')
64
+ return new InvalidLexiconError(e);
65
+ if (e.error === 'InvalidQuery')
66
+ return new InvalidQueryError(e);
67
+ if (e.error === 'InvalidName')
68
+ return new InvalidNameError(e);
69
+ if (e.error === 'NotAdditive')
70
+ return new NotAdditiveError(e);
71
+ if (e.error === 'NotCreator')
72
+ return new NotCreatorError(e);
73
+ if (e.error === 'UnknownType')
74
+ return new UnknownTypeError(e);
75
+ if (e.error === 'TooLarge')
76
+ return new TooLargeError(e);
77
+ if (e.error === 'NotConfigured')
78
+ return new NotConfiguredError(e);
79
+ if (e.error === 'RateLimitExceeded')
80
+ return new RateLimitExceededError(e);
81
+ }
82
+ return e;
83
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { HeadersMap, XRPCError } from '@atproto/xrpc';
5
+ export type QueryParams = {};
6
+ export interface InputSchema {
7
+ /** The runtime type (a community draft or a requested type). */
8
+ nsid: string;
9
+ /** Why, kept with the block. */
10
+ reason: string;
11
+ }
12
+ export interface OutputSchema {
13
+ nsid: string;
14
+ /** How many indexed records were removed. */
15
+ purged: number;
16
+ /** The type's page on techne.pub. */
17
+ page: string;
18
+ }
19
+ export interface CallOptions {
20
+ signal?: AbortSignal;
21
+ headers?: HeadersMap;
22
+ qp?: QueryParams;
23
+ encoding?: 'application/json';
24
+ }
25
+ export interface Response {
26
+ success: boolean;
27
+ headers: HeadersMap;
28
+ data: OutputSchema;
29
+ }
30
+ export declare class AuthenticationRequiredError extends XRPCError {
31
+ constructor(src: XRPCError);
32
+ }
33
+ export declare class ForbiddenError extends XRPCError {
34
+ constructor(src: XRPCError);
35
+ }
36
+ export declare class UnknownTypeError extends XRPCError {
37
+ constructor(src: XRPCError);
38
+ }
39
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { XRPCError } from '@atproto/xrpc';
5
+ import { validate as _validate } from '../../../../../lexicons.js';
6
+ import { is$typed as _is$typed, } from '../../../../../util.js';
7
+ const is$typed = _is$typed, validate = _validate;
8
+ const id = 'pub.techne.draft.registry.purgeType';
9
+ export class AuthenticationRequiredError extends XRPCError {
10
+ constructor(src) {
11
+ super(src.status, src.error, src.message, src.headers, { cause: src });
12
+ }
13
+ }
14
+ export class ForbiddenError extends XRPCError {
15
+ constructor(src) {
16
+ super(src.status, src.error, src.message, src.headers, { cause: src });
17
+ }
18
+ }
19
+ export class UnknownTypeError extends XRPCError {
20
+ constructor(src) {
21
+ super(src.status, src.error, src.message, src.headers, { cause: src });
22
+ }
23
+ }
24
+ export function toKnownErr(e) {
25
+ if (e instanceof XRPCError) {
26
+ if (e.error === 'AuthenticationRequired')
27
+ return new AuthenticationRequiredError(e);
28
+ if (e.error === 'Forbidden')
29
+ return new ForbiddenError(e);
30
+ if (e.error === 'UnknownType')
31
+ return new UnknownTypeError(e);
32
+ }
33
+ return e;
34
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { HeadersMap, XRPCError } from '@atproto/xrpc';
5
+ import type * as PubTechneDraftRegistryDefs from './defs.js';
6
+ export type QueryParams = {};
7
+ export interface InputSchema {
8
+ nsid: string;
9
+ /** Which of the type's fields fill the shared query roles, as a `{nsid}.query` document (pub.techne.draft.query#roles). Without it the type's records can only be got and listed. */
10
+ query?: {
11
+ [_ in string]: unknown;
12
+ };
13
+ }
14
+ export type OutputSchema = PubTechneDraftRegistryDefs.RequestView;
15
+ export interface CallOptions {
16
+ signal?: AbortSignal;
17
+ headers?: HeadersMap;
18
+ qp?: QueryParams;
19
+ encoding?: 'application/json';
20
+ }
21
+ export interface Response {
22
+ success: boolean;
23
+ headers: HeadersMap;
24
+ data: OutputSchema;
25
+ }
26
+ export declare class AuthenticationRequiredError extends XRPCError {
27
+ constructor(src: XRPCError);
28
+ }
29
+ export declare class NoSchemaError extends XRPCError {
30
+ constructor(src: XRPCError);
31
+ }
32
+ export declare class InvalidLexiconError extends XRPCError {
33
+ constructor(src: XRPCError);
34
+ }
35
+ export declare class InvalidQueryError extends XRPCError {
36
+ constructor(src: XRPCError);
37
+ }
38
+ export declare class AlreadyIndexedError extends XRPCError {
39
+ constructor(src: XRPCError);
40
+ }
41
+ export declare class InvalidRequestError extends XRPCError {
42
+ constructor(src: XRPCError);
43
+ }
44
+ export declare class TooLargeError extends XRPCError {
45
+ constructor(src: XRPCError);
46
+ }
47
+ export declare class NotConfiguredError extends XRPCError {
48
+ constructor(src: XRPCError);
49
+ }
50
+ export declare class RateLimitExceededError extends XRPCError {
51
+ constructor(src: XRPCError);
52
+ }
53
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { XRPCError } from '@atproto/xrpc';
5
+ import { validate as _validate } from '../../../../../lexicons.js';
6
+ import { is$typed as _is$typed, } from '../../../../../util.js';
7
+ const is$typed = _is$typed, validate = _validate;
8
+ const id = 'pub.techne.draft.registry.requestType';
9
+ export class AuthenticationRequiredError extends XRPCError {
10
+ constructor(src) {
11
+ super(src.status, src.error, src.message, src.headers, { cause: src });
12
+ }
13
+ }
14
+ export class NoSchemaError extends XRPCError {
15
+ constructor(src) {
16
+ super(src.status, src.error, src.message, src.headers, { cause: src });
17
+ }
18
+ }
19
+ export class InvalidLexiconError extends XRPCError {
20
+ constructor(src) {
21
+ super(src.status, src.error, src.message, src.headers, { cause: src });
22
+ }
23
+ }
24
+ export class InvalidQueryError extends XRPCError {
25
+ constructor(src) {
26
+ super(src.status, src.error, src.message, src.headers, { cause: src });
27
+ }
28
+ }
29
+ export class AlreadyIndexedError extends XRPCError {
30
+ constructor(src) {
31
+ super(src.status, src.error, src.message, src.headers, { cause: src });
32
+ }
33
+ }
34
+ export class InvalidRequestError extends XRPCError {
35
+ constructor(src) {
36
+ super(src.status, src.error, src.message, src.headers, { cause: src });
37
+ }
38
+ }
39
+ export class TooLargeError extends XRPCError {
40
+ constructor(src) {
41
+ super(src.status, src.error, src.message, src.headers, { cause: src });
42
+ }
43
+ }
44
+ export class NotConfiguredError extends XRPCError {
45
+ constructor(src) {
46
+ super(src.status, src.error, src.message, src.headers, { cause: src });
47
+ }
48
+ }
49
+ export class RateLimitExceededError extends XRPCError {
50
+ constructor(src) {
51
+ super(src.status, src.error, src.message, src.headers, { cause: src });
52
+ }
53
+ }
54
+ export function toKnownErr(e) {
55
+ if (e instanceof XRPCError) {
56
+ if (e.error === 'AuthenticationRequired')
57
+ return new AuthenticationRequiredError(e);
58
+ if (e.error === 'NoSchema')
59
+ return new NoSchemaError(e);
60
+ if (e.error === 'InvalidLexicon')
61
+ return new InvalidLexiconError(e);
62
+ if (e.error === 'InvalidQuery')
63
+ return new InvalidQueryError(e);
64
+ if (e.error === 'AlreadyIndexed')
65
+ return new AlreadyIndexedError(e);
66
+ if (e.error === 'InvalidRequest')
67
+ return new InvalidRequestError(e);
68
+ if (e.error === 'TooLarge')
69
+ return new TooLargeError(e);
70
+ if (e.error === 'NotConfigured')
71
+ return new NotConfiguredError(e);
72
+ if (e.error === 'RateLimitExceeded')
73
+ return new RateLimitExceededError(e);
74
+ }
75
+ return e;
76
+ }
@@ -0,0 +1,22 @@
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.registry.typeRequest';
8
+ /** The requested type; equal to the record key. */
9
+ nsid: string;
10
+ /** Who asked. */
11
+ requester: string;
12
+ schema: ComAtprotoRepoStrongRef.Main;
13
+ /** Which of the type's fields fill the shared query roles, as a `{nsid}.query` document (pub.techne.draft.query#roles). Without it the type's records can only be got and listed. */
14
+ query?: {
15
+ [_ in string]: unknown;
16
+ };
17
+ createdAt: string;
18
+ [k: string]: unknown;
19
+ }
20
+ export declare function isMain<V>(v: V): v is import("../../../../../util.js").$TypedObject<V, "pub.techne.draft.registry.typeRequest", "main">;
21
+ export declare function validateMain<V>(v: V): ValidationResult<Main & V>;
22
+ 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.registry.typeRequest';
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, };
@@ -11,7 +11,7 @@ export interface OutputSchema {
11
11
  uri: string;
12
12
  /** The version the platform fetched and verified: the version the decision is about. */
13
13
  cid: string;
14
- /** Whether this version counts. valid: it does. pending: nothing is wrong, but a claim it needs has not arrived yet (its author's membership, the root's credential for its author); a later read may say valid. invalid: it does not count, for the reason given (it is still in the author's repo; a version the platform refuses to index, such as one that is not valid for its lexicon, is not put on the stream). A curated version of the record, if a rule writes one, is another record. */
14
+ /** Whether this version counts. valid: it does. pending: nothing is wrong, but a claim it needs has not arrived yet (its author's membership, an admin writer's credential for its author: the root's, or an operator's the root names); a later read may say valid. invalid: it does not count, for the reason given (it is still in the author's repo; a version the platform refuses to index, such as one that is not valid for its lexicon, is not put on the stream). A curated version of the record, if a rule writes one, is another record. */
15
15
  decision: 'valid' | 'pending' | 'invalid' | (string & {});
16
16
  /** Why, when decision is invalid: the lexicon problems, no public home, no lexicon for the collection, or the provenance or trust rule it fails. */
17
17
  reason?: string;
@@ -6,8 +6,8 @@ import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongR
6
6
  export interface Main {
7
7
  $type: 'pub.techne.draft.verdict';
8
8
  subject: ComAtprotoRepoStrongRef.Main;
9
- /** What the version is. `spam`: advertising, scams, link farms or bulk promotion rather than a real gathering. `obscene`: sexually explicit or gratuitously graphic content. `!takedown`: an operator took the record down; it hides the record at every version. */
10
- values: ('spam' | 'obscene' | '!takedown' | (string & {}))[];
9
+ /** What the version is. `spam`: advertising, scams, link farms or bulk promotion rather than a real gathering. `obscene`: sexually explicit or gratuitously graphic content. `!takedown`: an operator took the record down; it hides the record at every version. `declined`: an operator declined a pub.techne.draft.registry.typeRequest at this version; it hides nothing. */
10
+ values: ('spam' | 'obscene' | '!takedown' | 'declined' | (string & {}))[];
11
11
  createdAt: string;
12
12
  [k: string]: unknown;
13
13
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Techne platform's service DID, the one name every audience the sign-in scopes build comes from
3
+ * (`techne-sdk/auth`). Internal: `techne-sdk/auth` re-exports {@link TECHNE_PLATFORM_DID}.
4
+ *
5
+ * It is the production name, `did:web:techne.computer`, whose document is
6
+ * `https://techne.computer/.well-known/did.json`. A test deployment (a `did:plc`) passes its own DID as
7
+ * the `platform` option instead.
8
+ */
9
+ /** The platform's service DID (production). */
10
+ export declare const TECHNE_PLATFORM_DID = "did:web:techne.computer";
11
+ /** The fragment naming the platform's service in its DID document. */
12
+ export declare const APPVIEW_SERVICE_ID = "#atproto_appview";
13
+ /** `did#atproto_appview`: what `atproto-proxy` and a permission set's `aud` name. */
14
+ export declare function appviewRef(platform?: string): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The Techne platform's service DID, the one name every audience the sign-in scopes build comes from
3
+ * (`techne-sdk/auth`). Internal: `techne-sdk/auth` re-exports {@link TECHNE_PLATFORM_DID}.
4
+ *
5
+ * It is the production name, `did:web:techne.computer`, whose document is
6
+ * `https://techne.computer/.well-known/did.json`. A test deployment (a `did:plc`) passes its own DID as
7
+ * the `platform` option instead.
8
+ */
9
+ /** The platform's service DID (production). */
10
+ export const TECHNE_PLATFORM_DID = 'did:web:techne.computer';
11
+ /** The fragment naming the platform's service in its DID document. */
12
+ export const APPVIEW_SERVICE_ID = '#atproto_appview';
13
+ /** `did#atproto_appview`: what `atproto-proxy` and a permission set's `aud` name. */
14
+ export function appviewRef(platform = TECHNE_PLATFORM_DID) {
15
+ return `${platform}${APPVIEW_SERVICE_ID}`;
16
+ }
package/dist/put/index.js CHANGED
@@ -14,7 +14,8 @@
14
14
  * 3. writes the public ones to the user's PDS in one atomic `com.atproto.repo.applyWrites`;
15
15
  * 4. with `deletes`: deletes the private ones, one `permissioned.deleteRecord` each (below);
16
16
  * 5. hints each public record (`sync.indexRecord`, signed as the user through the PDS) so the platform
17
- * indexes it ahead of the relay, and answers what the platform said.
17
+ * indexes it ahead of the relay, and answers what the platform said; and hints each public delete
18
+ * the PDS carried out, so the platform reads the PDS's proof that the record is gone and drops it.
18
19
  *
19
20
  * `put(techne, records, { deletes })` also deletes, in the same plan: a delete is private or public by
20
21
  * the same rule as a write (a `space` named, or a lexicon type with no public home, is private; a type
@@ -22,8 +23,11 @@
22
23
  * public deletes go into the same atomic `applyWrites` as the public writes (step 3); the private ones
23
24
  * go out after it (step 4), so nothing public is left pointing at a private record already gone. A
24
25
  * public delete the PDS does not hold is sent to the private delete too (a record kept in a space but
25
- * named without it), and each delete answers `deleted`: whether anything was there to delete. Deletes
26
- * are not hinted, so the platform drops a deleted public record when the relay brings the delete. A key
26
+ * named without it), and each delete answers `deleted`: whether anything was there to delete. Each
27
+ * public delete the PDS carried out is hinted too (`sync.indexRecord` of its URI): the platform asks the
28
+ * PDS, finds the record gone and drops it from the index, even for a type the relay does not bring it
29
+ * (a community or requested type not yet approved). A failed delete hint is ignored: the relay's delete,
30
+ * where it comes, does the same. A key
27
31
  * may not be both written and deleted, or deleted twice, in one put, and only the writer's own records
28
32
  * (by DID) can be deleted. A contact deleted in the same put no longer counts for the contact check.
29
33
  *
@@ -104,6 +108,8 @@ export async function put(techne, records, options = {}) {
104
108
  throw new PutError(refused);
105
109
  }
106
110
  const done = new Map();
111
+ // The public deletes the PDS carried out in the applyWrites, hinted after (step 5).
112
+ const pdsDeleted = [];
107
113
  if (publics.length || publicDeletes.length) {
108
114
  const current = await Promise.all(publics.map((w) => currentCid(techne, w)));
109
115
  const ops = publics.flatMap((w, i) => current[i] === w.cid
@@ -117,9 +123,12 @@ export async function put(techne, records, options = {}) {
117
123
  }
118
124
  if (ops.length)
119
125
  await techne.pds.com.atproto.repo.applyWrites({ repo: did, writes: ops });
120
- for (const [i, d] of publicDeletes.entries())
121
- if (held[i])
122
- done.set(d.uri, true);
126
+ for (const [i, d] of publicDeletes.entries()) {
127
+ if (!held[i])
128
+ continue;
129
+ done.set(d.uri, true);
130
+ pdsDeleted.push(d.uri);
131
+ }
123
132
  }
124
133
  // Private deletes after the public leg: nothing public is left pointing at what they remove. A public
125
134
  // delete the PDS did not hold goes here too: a record of that collection kept in a space, named
@@ -131,7 +140,8 @@ export async function put(techne, records, options = {}) {
131
140
  done.set(d.uri, Boolean(data.rev));
132
141
  }
133
142
  const answers = new Map();
134
- await Promise.all(publics.map(async (w) => answers.set(w, await hint(techne, w.uri))));
143
+ // The public deletes are hinted beside the writes; their answer is not kept (a failed hint is ignored).
144
+ await Promise.all([...publics.map(async (w) => answers.set(w, await hint(techne, w.uri))), ...pdsDeleted.map((uri) => hint(techne, uri))]);
135
145
  const curatable = publics.filter((w) => w.lexicon);
136
146
  const counted = (curatable.length ? curatable : publics).map((w) => answers.get(w));
137
147
  const status = counted.find((a) => a.decision === 'invalid') ?? { decision: 'pending' };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A read is a `pub.techne.draft.query`: a `where` tree over shared roles (`type`, `author`, `subject`,
5
5
  * `space`, `uri`, `written`, and what each type's query document declares: `start`, `end`, `location`,
6
- * `text`, `references`), one `order`, `include` and `signals`. The platform scopes every query to what the
6
+ * `text`, `references`), one `order` and `signals`. The platform scopes every query to what the
7
7
  * viewer may read and proves it bounded; this module only carries it: `listRecords` (one page),
8
8
  * `listAllRecords` (every page), `countRecords`, and `getRecords` (by URI, in batches the platform takes; `getRecordsAnswer` also says which
9
9
  * asked URIs moderation withheld).
@@ -33,10 +33,6 @@ export interface Query {
33
33
  readonly where: QueryNode;
34
34
  readonly order?: string;
35
35
  readonly limit?: number;
36
- readonly include?: {
37
- readonly author?: 'profile';
38
- readonly subject?: 'record';
39
- };
40
36
  readonly signals?: readonly Readonly<Record<string, unknown>>[];
41
37
  readonly curated?: boolean;
42
38
  /** The seed of `order: 'shuffle'`, a literal or a parameter (`$seed`); required with it. */
@@ -65,11 +61,6 @@ export interface QueryRecord<V = Record<string, unknown>> {
65
61
  /** The numbers the query's operators produced, by name (a `near` distance in metres). */
66
62
  measures?: Record<string, number>;
67
63
  signals?: Record<string, number>;
68
- /** The records `include` attached: the author's profile, the subject's record. */
69
- included?: {
70
- author?: QueryRecord;
71
- subject?: QueryRecord;
72
- };
73
64
  }
74
65
  export interface ListPage<V = Record<string, unknown>> {
75
66
  records: QueryRecord<V>[];
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A read is a `pub.techne.draft.query`: a `where` tree over shared roles (`type`, `author`, `subject`,
5
5
  * `space`, `uri`, `written`, and what each type's query document declares: `start`, `end`, `location`,
6
- * `text`, `references`), one `order`, `include` and `signals`. The platform scopes every query to what the
6
+ * `text`, `references`), one `order` and `signals`. The platform scopes every query to what the
7
7
  * viewer may read and proves it bounded; this module only carries it: `listRecords` (one page),
8
8
  * `listAllRecords` (every page), `countRecords`, and `getRecords` (by URI, in batches the platform takes; `getRecordsAnswer` also says which
9
9
  * asked URIs moderation withheld).
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A lexicon document, as `registry.getType` or a `com.atproto.lexicon.schema` record carries it: only what
3
+ * {@link isLexiconDoc} checks. Not @atproto/lexicon's LexiconDoc: its parseLexiconDoc refuses documents this
4
+ * emitter reads on purpose (an inline object property, a non-main method def), and each def here is read
5
+ * field by field and checked as it is emitted.
6
+ */
7
+ export interface LexiconDoc {
8
+ lexicon: number;
9
+ id: string;
10
+ description?: string;
11
+ defs: Record<string, unknown>;
12
+ }
13
+ /** Whether `v` has a lexicon document's shape: a numeric `lexicon`, a string `id` and an object `defs`. */
14
+ export declare function isLexiconDoc(v: unknown): v is LexiconDoc;
15
+ /** The exported name of one def of `nsid`. */
16
+ export declare function defName(nsid: string, def: string): string;
17
+ /** TypeScript for every def of `lexicon`, `main` first. `source` goes in the header (where it came from). */
18
+ export declare function emitTypes(lexicon: LexiconDoc, options?: {
19
+ source?: string;
20
+ }): string;