@atproto/bsky 0.0.197 → 0.0.198

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 (44) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/lexicon/index.d.ts +11 -0
  3. package/dist/lexicon/index.d.ts.map +1 -1
  4. package/dist/lexicon/index.js +32 -1
  5. package/dist/lexicon/index.js.map +1 -1
  6. package/dist/lexicon/lexicons.d.ts +700 -0
  7. package/dist/lexicon/lexicons.d.ts.map +1 -1
  8. package/dist/lexicon/lexicons.js +367 -0
  9. package/dist/lexicon/lexicons.js.map +1 -1
  10. package/dist/lexicon/types/app/bsky/ageassurance/begin.d.ts +31 -0
  11. package/dist/lexicon/types/app/bsky/ageassurance/begin.d.ts.map +1 -0
  12. package/dist/lexicon/types/app/bsky/ageassurance/begin.js +7 -0
  13. package/dist/lexicon/types/app/bsky/ageassurance/begin.js.map +1 -0
  14. package/dist/lexicon/types/app/bsky/ageassurance/defs.d.ts +138 -0
  15. package/dist/lexicon/types/app/bsky/ageassurance/defs.d.ts.map +1 -0
  16. package/dist/lexicon/types/app/bsky/ageassurance/defs.js +115 -0
  17. package/dist/lexicon/types/app/bsky/ageassurance/defs.js.map +1 -0
  18. package/dist/lexicon/types/app/bsky/ageassurance/getConfig.d.ts +18 -0
  19. package/dist/lexicon/types/app/bsky/ageassurance/getConfig.d.ts.map +1 -0
  20. package/dist/lexicon/types/app/bsky/ageassurance/getConfig.js +7 -0
  21. package/dist/lexicon/types/app/bsky/ageassurance/getConfig.js.map +1 -0
  22. package/dist/lexicon/types/app/bsky/ageassurance/getState.d.ts +24 -0
  23. package/dist/lexicon/types/app/bsky/ageassurance/getState.d.ts.map +1 -0
  24. package/dist/lexicon/types/app/bsky/ageassurance/getState.js +7 -0
  25. package/dist/lexicon/types/app/bsky/ageassurance/getState.js.map +1 -0
  26. package/dist/stash.d.ts.map +1 -1
  27. package/dist/stash.js +1 -0
  28. package/dist/stash.js.map +1 -1
  29. package/package.json +14 -14
  30. package/src/lexicon/index.ts +49 -0
  31. package/src/lexicon/lexicons.ts +392 -0
  32. package/src/lexicon/types/app/bsky/ageassurance/begin.ts +54 -0
  33. package/src/lexicon/types/app/bsky/ageassurance/defs.ts +301 -0
  34. package/src/lexicon/types/app/bsky/ageassurance/getConfig.ts +34 -0
  35. package/src/lexicon/types/app/bsky/ageassurance/getState.ts +42 -0
  36. package/src/stash.ts +2 -0
  37. package/tests/blob-resolver.test.ts +2 -0
  38. package/tests/data-plane/duplicate-records.test.ts +2 -0
  39. package/tests/data-plane/indexing.test.ts +2 -0
  40. package/tests/data-plane/subscription.test.ts +2 -0
  41. package/tests/image/server.test.ts +2 -0
  42. package/tests/image/uri.test.ts +2 -0
  43. package/tests/views/posts.test.ts +96 -0
  44. package/tsconfig.build.tsbuildinfo +1 -1
@@ -0,0 +1,31 @@
1
+ import type * as AppBskyAgeassuranceDefs from './defs.js';
2
+ export type QueryParams = {};
3
+ export interface InputSchema {
4
+ /** The user's email address to receive Age Assurance instructions. */
5
+ email: string;
6
+ /** The user's preferred language for communication during the Age Assurance process. */
7
+ language: string;
8
+ /** An ISO 3166-1 alpha-2 code of the user's location. */
9
+ countryCode: string;
10
+ /** An optional ISO 3166-2 code of the user's region or state within the country. */
11
+ regionCode?: string;
12
+ }
13
+ export type OutputSchema = AppBskyAgeassuranceDefs.State;
14
+ export interface HandlerInput {
15
+ encoding: 'application/json';
16
+ body: InputSchema;
17
+ }
18
+ export interface HandlerSuccess {
19
+ encoding: 'application/json';
20
+ body: OutputSchema;
21
+ headers?: {
22
+ [key: string]: string;
23
+ };
24
+ }
25
+ export interface HandlerError {
26
+ status: number;
27
+ message?: string;
28
+ error?: 'InvalidEmail' | 'DidTooLong' | 'InvalidInitiation' | 'RegionNotSupported';
29
+ }
30
+ export type HandlerOutput = HandlerError | HandlerSuccess;
31
+ //# sourceMappingURL=begin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"begin.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/begin.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,uBAAuB,MAAM,WAAW,CAAA;AAMzD,MAAM,MAAM,WAAW,GAAG,EAAE,CAAA;AAE5B,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,wFAAwF;IACxF,QAAQ,EAAE,MAAM,CAAA;IAChB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAA;IACnB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAC,KAAK,CAAA;AAExD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EACF,cAAc,GACd,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,CAAA;CACzB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lexicons_1 = require("../../../../lexicons");
4
+ const util_1 = require("../../../../util");
5
+ const is$typed = util_1.is$typed, validate = lexicons_1.validate;
6
+ const id = 'app.bsky.ageassurance.begin';
7
+ //# sourceMappingURL=begin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"begin.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/begin.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,6BAA6B,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\nimport type * as AppBskyAgeassuranceDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.ageassurance.begin'\n\nexport type QueryParams = {}\n\nexport interface InputSchema {\n /** The user's email address to receive Age Assurance instructions. */\n email: string\n /** The user's preferred language for communication during the Age Assurance process. */\n language: string\n /** An ISO 3166-1 alpha-2 code of the user's location. */\n countryCode: string\n /** An optional ISO 3166-2 code of the user's region or state within the country. */\n regionCode?: string\n}\n\nexport type OutputSchema = AppBskyAgeassuranceDefs.State\n\nexport interface HandlerInput {\n encoding: 'application/json'\n body: InputSchema\n}\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n error?:\n | 'InvalidEmail'\n | 'DidTooLong'\n | 'InvalidInitiation'\n | 'RegionNotSupported'\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult } from '@atproto/lexicon';
5
+ import { type $Typed } from '../../../../util';
6
+ /** The access level granted based on Age Assurance data we've processed. */
7
+ export type Access = 'unknown' | 'none' | 'safe' | 'full' | (string & {});
8
+ /** The status of the Age Assurance process. */
9
+ export type Status = 'unknown' | 'pending' | 'assured' | 'blocked' | (string & {});
10
+ /** The user's computed Age Assurance state. */
11
+ export interface State {
12
+ $type?: 'app.bsky.ageassurance.defs#state';
13
+ /** The timestamp when this state was last updated. */
14
+ lastInitiatedAt?: string;
15
+ status: Status;
16
+ access: Access;
17
+ }
18
+ export declare function isState<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "state">;
19
+ export declare function validateState<V>(v: V): ValidationResult<State & V>;
20
+ /** Additional metadata needed to compute Age Assurance state client-side. */
21
+ export interface StateMetadata {
22
+ $type?: 'app.bsky.ageassurance.defs#stateMetadata';
23
+ /** The account creation timestamp. */
24
+ accountCreatedAt?: string;
25
+ }
26
+ export declare function isStateMetadata<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "stateMetadata">;
27
+ export declare function validateStateMetadata<V>(v: V): ValidationResult<StateMetadata & V>;
28
+ export interface Config {
29
+ $type?: 'app.bsky.ageassurance.defs#config';
30
+ /** The per-region Age Assurance configuration. */
31
+ regions: ConfigRegion[];
32
+ }
33
+ export declare function isConfig<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "config">;
34
+ export declare function validateConfig<V>(v: V): ValidationResult<Config & V>;
35
+ /** The Age Assurance configuration for a specific region. */
36
+ export interface ConfigRegion {
37
+ $type?: 'app.bsky.ageassurance.defs#configRegion';
38
+ /** The ISO 3166-1 alpha-2 country code this configuration applies to. */
39
+ countryCode: string;
40
+ /** The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country. */
41
+ regionCode?: string;
42
+ /** The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item. */
43
+ rules: ($Typed<ConfigRegionRuleDefault> | $Typed<ConfigRegionRuleIfDeclaredOverAge> | $Typed<ConfigRegionRuleIfDeclaredUnderAge> | $Typed<ConfigRegionRuleIfAssuredOverAge> | $Typed<ConfigRegionRuleIfAssuredUnderAge> | $Typed<ConfigRegionRuleIfAccountNewerThan> | $Typed<ConfigRegionRuleIfAccountOlderThan> | {
44
+ $type: string;
45
+ })[];
46
+ }
47
+ export declare function isConfigRegion<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegion">;
48
+ export declare function validateConfigRegion<V>(v: V): ValidationResult<ConfigRegion & V>;
49
+ /** Age Assurance rule that applies by default. */
50
+ export interface ConfigRegionRuleDefault {
51
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleDefault';
52
+ access: Access;
53
+ }
54
+ export declare function isConfigRegionRuleDefault<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleDefault">;
55
+ export declare function validateConfigRegionRuleDefault<V>(v: V): ValidationResult<ConfigRegionRuleDefault & V>;
56
+ /** Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age. */
57
+ export interface ConfigRegionRuleIfDeclaredOverAge {
58
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge';
59
+ /** The age threshold as a whole integer. */
60
+ age: number;
61
+ access: Access;
62
+ }
63
+ export declare function isConfigRegionRuleIfDeclaredOverAge<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleIfDeclaredOverAge">;
64
+ export declare function validateConfigRegionRuleIfDeclaredOverAge<V>(v: V): ValidationResult<ConfigRegionRuleIfDeclaredOverAge & V>;
65
+ /** Age Assurance rule that applies if the user has declared themselves under a certain age. */
66
+ export interface ConfigRegionRuleIfDeclaredUnderAge {
67
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge';
68
+ /** The age threshold as a whole integer. */
69
+ age: number;
70
+ access: Access;
71
+ }
72
+ export declare function isConfigRegionRuleIfDeclaredUnderAge<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleIfDeclaredUnderAge">;
73
+ export declare function validateConfigRegionRuleIfDeclaredUnderAge<V>(v: V): ValidationResult<ConfigRegionRuleIfDeclaredUnderAge & V>;
74
+ /** Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age. */
75
+ export interface ConfigRegionRuleIfAssuredOverAge {
76
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge';
77
+ /** The age threshold as a whole integer. */
78
+ age: number;
79
+ access: Access;
80
+ }
81
+ export declare function isConfigRegionRuleIfAssuredOverAge<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleIfAssuredOverAge">;
82
+ export declare function validateConfigRegionRuleIfAssuredOverAge<V>(v: V): ValidationResult<ConfigRegionRuleIfAssuredOverAge & V>;
83
+ /** Age Assurance rule that applies if the user has been assured to be under a certain age. */
84
+ export interface ConfigRegionRuleIfAssuredUnderAge {
85
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge';
86
+ /** The age threshold as a whole integer. */
87
+ age: number;
88
+ access: Access;
89
+ }
90
+ export declare function isConfigRegionRuleIfAssuredUnderAge<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleIfAssuredUnderAge">;
91
+ export declare function validateConfigRegionRuleIfAssuredUnderAge<V>(v: V): ValidationResult<ConfigRegionRuleIfAssuredUnderAge & V>;
92
+ /** Age Assurance rule that applies if the account is equal-to or newer than a certain date. */
93
+ export interface ConfigRegionRuleIfAccountNewerThan {
94
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan';
95
+ /** The date threshold as a datetime string. */
96
+ date: string;
97
+ access: Access;
98
+ }
99
+ export declare function isConfigRegionRuleIfAccountNewerThan<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleIfAccountNewerThan">;
100
+ export declare function validateConfigRegionRuleIfAccountNewerThan<V>(v: V): ValidationResult<ConfigRegionRuleIfAccountNewerThan & V>;
101
+ /** Age Assurance rule that applies if the account is older than a certain date. */
102
+ export interface ConfigRegionRuleIfAccountOlderThan {
103
+ $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan';
104
+ /** The date threshold as a datetime string. */
105
+ date: string;
106
+ access: Access;
107
+ }
108
+ export declare function isConfigRegionRuleIfAccountOlderThan<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "configRegionRuleIfAccountOlderThan">;
109
+ export declare function validateConfigRegionRuleIfAccountOlderThan<V>(v: V): ValidationResult<ConfigRegionRuleIfAccountOlderThan & V>;
110
+ /** Object used to store Age Assurance data in stash. */
111
+ export interface Event {
112
+ $type?: 'app.bsky.ageassurance.defs#event';
113
+ /** The date and time of this write operation. */
114
+ createdAt: string;
115
+ /** The unique identifier for this instance of the Age Assurance flow, in UUID format. */
116
+ attemptId: string;
117
+ /** The status of the Age Assurance process. */
118
+ status: 'unknown' | 'pending' | 'assured' | 'blocked' | (string & {});
119
+ /** The access level granted based on Age Assurance data we've processed. */
120
+ access: 'unknown' | 'none' | 'safe' | 'full' | (string & {});
121
+ /** The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow. */
122
+ countryCode: string;
123
+ /** The ISO 3166-2 region code provided when beginning the Age Assurance flow. */
124
+ regionCode?: string;
125
+ /** The email used for Age Assurance. */
126
+ email?: string;
127
+ /** The IP address used when initiating the Age Assurance flow. */
128
+ initIp?: string;
129
+ /** The user agent used when initiating the Age Assurance flow. */
130
+ initUa?: string;
131
+ /** The IP address used when completing the Age Assurance flow. */
132
+ completeIp?: string;
133
+ /** The user agent used when completing the Age Assurance flow. */
134
+ completeUa?: string;
135
+ }
136
+ export declare function isEvent<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.ageassurance.defs", "event">;
137
+ export declare function validateEvent<V>(v: V): ValidationResult<Event & V>;
138
+ //# sourceMappingURL=defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/defs.ts"],"names":[],"mappings":"AAAA;;GA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AAM,CAAA;CACf;AAKD,wBAAgB,oCAAoC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,uHAE3D;AAED,wBAAgB,0CAA0C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,4DAMjE;AAED,wDAAwD;AACxD,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,kCAAkC,CAAA;IAC1C,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAA;IACjB,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAA;IACjB,+CAA+C;IAC/C,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACrE,4EAA4E;IAC5E,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IAC5D,0FAA0F;IAC1F,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAID,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,0FAE9B;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,+BAEpC"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isState = isState;
4
+ exports.validateState = validateState;
5
+ exports.isStateMetadata = isStateMetadata;
6
+ exports.validateStateMetadata = validateStateMetadata;
7
+ exports.isConfig = isConfig;
8
+ exports.validateConfig = validateConfig;
9
+ exports.isConfigRegion = isConfigRegion;
10
+ exports.validateConfigRegion = validateConfigRegion;
11
+ exports.isConfigRegionRuleDefault = isConfigRegionRuleDefault;
12
+ exports.validateConfigRegionRuleDefault = validateConfigRegionRuleDefault;
13
+ exports.isConfigRegionRuleIfDeclaredOverAge = isConfigRegionRuleIfDeclaredOverAge;
14
+ exports.validateConfigRegionRuleIfDeclaredOverAge = validateConfigRegionRuleIfDeclaredOverAge;
15
+ exports.isConfigRegionRuleIfDeclaredUnderAge = isConfigRegionRuleIfDeclaredUnderAge;
16
+ exports.validateConfigRegionRuleIfDeclaredUnderAge = validateConfigRegionRuleIfDeclaredUnderAge;
17
+ exports.isConfigRegionRuleIfAssuredOverAge = isConfigRegionRuleIfAssuredOverAge;
18
+ exports.validateConfigRegionRuleIfAssuredOverAge = validateConfigRegionRuleIfAssuredOverAge;
19
+ exports.isConfigRegionRuleIfAssuredUnderAge = isConfigRegionRuleIfAssuredUnderAge;
20
+ exports.validateConfigRegionRuleIfAssuredUnderAge = validateConfigRegionRuleIfAssuredUnderAge;
21
+ exports.isConfigRegionRuleIfAccountNewerThan = isConfigRegionRuleIfAccountNewerThan;
22
+ exports.validateConfigRegionRuleIfAccountNewerThan = validateConfigRegionRuleIfAccountNewerThan;
23
+ exports.isConfigRegionRuleIfAccountOlderThan = isConfigRegionRuleIfAccountOlderThan;
24
+ exports.validateConfigRegionRuleIfAccountOlderThan = validateConfigRegionRuleIfAccountOlderThan;
25
+ exports.isEvent = isEvent;
26
+ exports.validateEvent = validateEvent;
27
+ const lexicons_1 = require("../../../../lexicons");
28
+ const util_1 = require("../../../../util");
29
+ const is$typed = util_1.is$typed, validate = lexicons_1.validate;
30
+ const id = 'app.bsky.ageassurance.defs';
31
+ const hashState = 'state';
32
+ function isState(v) {
33
+ return is$typed(v, id, hashState);
34
+ }
35
+ function validateState(v) {
36
+ return validate(v, id, hashState);
37
+ }
38
+ const hashStateMetadata = 'stateMetadata';
39
+ function isStateMetadata(v) {
40
+ return is$typed(v, id, hashStateMetadata);
41
+ }
42
+ function validateStateMetadata(v) {
43
+ return validate(v, id, hashStateMetadata);
44
+ }
45
+ const hashConfig = 'config';
46
+ function isConfig(v) {
47
+ return is$typed(v, id, hashConfig);
48
+ }
49
+ function validateConfig(v) {
50
+ return validate(v, id, hashConfig);
51
+ }
52
+ const hashConfigRegion = 'configRegion';
53
+ function isConfigRegion(v) {
54
+ return is$typed(v, id, hashConfigRegion);
55
+ }
56
+ function validateConfigRegion(v) {
57
+ return validate(v, id, hashConfigRegion);
58
+ }
59
+ const hashConfigRegionRuleDefault = 'configRegionRuleDefault';
60
+ function isConfigRegionRuleDefault(v) {
61
+ return is$typed(v, id, hashConfigRegionRuleDefault);
62
+ }
63
+ function validateConfigRegionRuleDefault(v) {
64
+ return validate(v, id, hashConfigRegionRuleDefault);
65
+ }
66
+ const hashConfigRegionRuleIfDeclaredOverAge = 'configRegionRuleIfDeclaredOverAge';
67
+ function isConfigRegionRuleIfDeclaredOverAge(v) {
68
+ return is$typed(v, id, hashConfigRegionRuleIfDeclaredOverAge);
69
+ }
70
+ function validateConfigRegionRuleIfDeclaredOverAge(v) {
71
+ return validate(v, id, hashConfigRegionRuleIfDeclaredOverAge);
72
+ }
73
+ const hashConfigRegionRuleIfDeclaredUnderAge = 'configRegionRuleIfDeclaredUnderAge';
74
+ function isConfigRegionRuleIfDeclaredUnderAge(v) {
75
+ return is$typed(v, id, hashConfigRegionRuleIfDeclaredUnderAge);
76
+ }
77
+ function validateConfigRegionRuleIfDeclaredUnderAge(v) {
78
+ return validate(v, id, hashConfigRegionRuleIfDeclaredUnderAge);
79
+ }
80
+ const hashConfigRegionRuleIfAssuredOverAge = 'configRegionRuleIfAssuredOverAge';
81
+ function isConfigRegionRuleIfAssuredOverAge(v) {
82
+ return is$typed(v, id, hashConfigRegionRuleIfAssuredOverAge);
83
+ }
84
+ function validateConfigRegionRuleIfAssuredOverAge(v) {
85
+ return validate(v, id, hashConfigRegionRuleIfAssuredOverAge);
86
+ }
87
+ const hashConfigRegionRuleIfAssuredUnderAge = 'configRegionRuleIfAssuredUnderAge';
88
+ function isConfigRegionRuleIfAssuredUnderAge(v) {
89
+ return is$typed(v, id, hashConfigRegionRuleIfAssuredUnderAge);
90
+ }
91
+ function validateConfigRegionRuleIfAssuredUnderAge(v) {
92
+ return validate(v, id, hashConfigRegionRuleIfAssuredUnderAge);
93
+ }
94
+ const hashConfigRegionRuleIfAccountNewerThan = 'configRegionRuleIfAccountNewerThan';
95
+ function isConfigRegionRuleIfAccountNewerThan(v) {
96
+ return is$typed(v, id, hashConfigRegionRuleIfAccountNewerThan);
97
+ }
98
+ function validateConfigRegionRuleIfAccountNewerThan(v) {
99
+ return validate(v, id, hashConfigRegionRuleIfAccountNewerThan);
100
+ }
101
+ const hashConfigRegionRuleIfAccountOlderThan = 'configRegionRuleIfAccountOlderThan';
102
+ function isConfigRegionRuleIfAccountOlderThan(v) {
103
+ return is$typed(v, id, hashConfigRegionRuleIfAccountOlderThan);
104
+ }
105
+ function validateConfigRegionRuleIfAccountOlderThan(v) {
106
+ return validate(v, id, hashConfigRegionRuleIfAccountOlderThan);
107
+ }
108
+ const hashEvent = 'event';
109
+ function isEvent(v) {
110
+ return is$typed(v, id, hashEvent);
111
+ }
112
+ function validateEvent(v) {
113
+ return validate(v, id, hashEvent);
114
+ }
115
+ //# sourceMappingURL=defs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/defs.ts"],"names":[],"mappings":";;AAqCA,0BAEC;AAED,sCAEC;AAWD,0CAEC;AAED,sDAEC;AAUD,4BAEC;AAED,wCAEC;AAwBD,wCAEC;AAED,oDAEC;AAUD,8DAEC;AAED,0EAMC;AAaD,kFAEC;AAED,8FAMC;AAaD,oFAEC;AAED,gGAMC;AAYD,gFAEC;AAED,4FAMC;AAaD,kFAEC;AAED,8FAMC;AAaD,oFAEC;AAED,gGAMC;A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AC,CAAA;AAC/D,CAAC;AAED,SAAgB,yCAAyC,CAAI,CAAI;IAC/D,OAAO,QAAQ,CACb,CAAC,EACD,EAAE,EACF,qCAAqC,CACtC,CAAA;AACH,CAAC;AAUD,MAAM,sCAAsC,GAC1C,oCAAoC,CAAA;AAEtC,SAAgB,oCAAoC,CAAI,CAAI;IAC1D,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,sCAAsC,CAAC,CAAA;AAChE,CAAC;AAED,SAAgB,0CAA0C,CAAI,CAAI;IAChE,OAAO,QAAQ,CACb,CAAC,EACD,EAAE,EACF,sCAAsC,CACvC,CAAA;AACH,CAAC;AAUD,MAAM,sCAAsC,GAC1C,oCAAoC,CAAA;AAEtC,SAAgB,oCAAoC,CAAI,CAAI;IAC1D,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,sCAAsC,CAAC,CAAA;AAChE,CAAC;AAED,SAAgB,0CAA0C,CAAI,CAAI;IAChE,OAAO,QAAQ,CACb,CAAC,EACD,EAAE,EACF,sCAAsC,CACvC,CAAA;AACH,CAAC;AA6BD,MAAM,SAAS,GAAG,OAAO,CAAA;AAEzB,SAAgB,OAAO,CAAI,CAAI;IAC7B,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;AACnC,CAAC;AAED,SAAgB,aAAa,CAAI,CAAI;IACnC,OAAO,QAAQ,CAAY,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.ageassurance.defs'\n\n/** The access level granted based on Age Assurance data we've processed. */\nexport type Access = 'unknown' | 'none' | 'safe' | 'full' | (string & {})\n/** The status of the Age Assurance process. */\nexport type Status =\n | 'unknown'\n | 'pending'\n | 'assured'\n | 'blocked'\n | (string & {})\n\n/** The user's computed Age Assurance state. */\nexport interface State {\n $type?: 'app.bsky.ageassurance.defs#state'\n /** The timestamp when this state was last updated. */\n lastInitiatedAt?: string\n status: Status\n access: Access\n}\n\nconst hashState = 'state'\n\nexport function isState<V>(v: V) {\n return is$typed(v, id, hashState)\n}\n\nexport function validateState<V>(v: V) {\n return validate<State & V>(v, id, hashState)\n}\n\n/** Additional metadata needed to compute Age Assurance state client-side. */\nexport interface StateMetadata {\n $type?: 'app.bsky.ageassurance.defs#stateMetadata'\n /** The account creation timestamp. */\n accountCreatedAt?: string\n}\n\nconst hashStateMetadata = 'stateMetadata'\n\nexport function isStateMetadata<V>(v: V) {\n return is$typed(v, id, hashStateMetadata)\n}\n\nexport function validateStateMetadata<V>(v: V) {\n return validate<StateMetadata & V>(v, id, hashStateMetadata)\n}\n\nexport interface Config {\n $type?: 'app.bsky.ageassurance.defs#config'\n /** The per-region Age Assurance configuration. */\n regions: ConfigRegion[]\n}\n\nconst hashConfig = 'config'\n\nexport function isConfig<V>(v: V) {\n return is$typed(v, id, hashConfig)\n}\n\nexport function validateConfig<V>(v: V) {\n return validate<Config & V>(v, id, hashConfig)\n}\n\n/** The Age Assurance configuration for a specific region. */\nexport interface ConfigRegion {\n $type?: 'app.bsky.ageassurance.defs#configRegion'\n /** The ISO 3166-1 alpha-2 country code this configuration applies to. */\n countryCode: string\n /** The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country. */\n regionCode?: string\n /** The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item. */\n rules: (\n | $Typed<ConfigRegionRuleDefault>\n | $Typed<ConfigRegionRuleIfDeclaredOverAge>\n | $Typed<ConfigRegionRuleIfDeclaredUnderAge>\n | $Typed<ConfigRegionRuleIfAssuredOverAge>\n | $Typed<ConfigRegionRuleIfAssuredUnderAge>\n | $Typed<ConfigRegionRuleIfAccountNewerThan>\n | $Typed<ConfigRegionRuleIfAccountOlderThan>\n | { $type: string }\n )[]\n}\n\nconst hashConfigRegion = 'configRegion'\n\nexport function isConfigRegion<V>(v: V) {\n return is$typed(v, id, hashConfigRegion)\n}\n\nexport function validateConfigRegion<V>(v: V) {\n return validate<ConfigRegion & V>(v, id, hashConfigRegion)\n}\n\n/** Age Assurance rule that applies by default. */\nexport interface ConfigRegionRuleDefault {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleDefault'\n access: Access\n}\n\nconst hashConfigRegionRuleDefault = 'configRegionRuleDefault'\n\nexport function isConfigRegionRuleDefault<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleDefault)\n}\n\nexport function validateConfigRegionRuleDefault<V>(v: V) {\n return validate<ConfigRegionRuleDefault & V>(\n v,\n id,\n hashConfigRegionRuleDefault,\n )\n}\n\n/** Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age. */\nexport interface ConfigRegionRuleIfDeclaredOverAge {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge'\n /** The age threshold as a whole integer. */\n age: number\n access: Access\n}\n\nconst hashConfigRegionRuleIfDeclaredOverAge =\n 'configRegionRuleIfDeclaredOverAge'\n\nexport function isConfigRegionRuleIfDeclaredOverAge<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleIfDeclaredOverAge)\n}\n\nexport function validateConfigRegionRuleIfDeclaredOverAge<V>(v: V) {\n return validate<ConfigRegionRuleIfDeclaredOverAge & V>(\n v,\n id,\n hashConfigRegionRuleIfDeclaredOverAge,\n )\n}\n\n/** Age Assurance rule that applies if the user has declared themselves under a certain age. */\nexport interface ConfigRegionRuleIfDeclaredUnderAge {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge'\n /** The age threshold as a whole integer. */\n age: number\n access: Access\n}\n\nconst hashConfigRegionRuleIfDeclaredUnderAge =\n 'configRegionRuleIfDeclaredUnderAge'\n\nexport function isConfigRegionRuleIfDeclaredUnderAge<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleIfDeclaredUnderAge)\n}\n\nexport function validateConfigRegionRuleIfDeclaredUnderAge<V>(v: V) {\n return validate<ConfigRegionRuleIfDeclaredUnderAge & V>(\n v,\n id,\n hashConfigRegionRuleIfDeclaredUnderAge,\n )\n}\n\n/** Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age. */\nexport interface ConfigRegionRuleIfAssuredOverAge {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge'\n /** The age threshold as a whole integer. */\n age: number\n access: Access\n}\n\nconst hashConfigRegionRuleIfAssuredOverAge = 'configRegionRuleIfAssuredOverAge'\n\nexport function isConfigRegionRuleIfAssuredOverAge<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleIfAssuredOverAge)\n}\n\nexport function validateConfigRegionRuleIfAssuredOverAge<V>(v: V) {\n return validate<ConfigRegionRuleIfAssuredOverAge & V>(\n v,\n id,\n hashConfigRegionRuleIfAssuredOverAge,\n )\n}\n\n/** Age Assurance rule that applies if the user has been assured to be under a certain age. */\nexport interface ConfigRegionRuleIfAssuredUnderAge {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge'\n /** The age threshold as a whole integer. */\n age: number\n access: Access\n}\n\nconst hashConfigRegionRuleIfAssuredUnderAge =\n 'configRegionRuleIfAssuredUnderAge'\n\nexport function isConfigRegionRuleIfAssuredUnderAge<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleIfAssuredUnderAge)\n}\n\nexport function validateConfigRegionRuleIfAssuredUnderAge<V>(v: V) {\n return validate<ConfigRegionRuleIfAssuredUnderAge & V>(\n v,\n id,\n hashConfigRegionRuleIfAssuredUnderAge,\n )\n}\n\n/** Age Assurance rule that applies if the account is equal-to or newer than a certain date. */\nexport interface ConfigRegionRuleIfAccountNewerThan {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan'\n /** The date threshold as a datetime string. */\n date: string\n access: Access\n}\n\nconst hashConfigRegionRuleIfAccountNewerThan =\n 'configRegionRuleIfAccountNewerThan'\n\nexport function isConfigRegionRuleIfAccountNewerThan<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleIfAccountNewerThan)\n}\n\nexport function validateConfigRegionRuleIfAccountNewerThan<V>(v: V) {\n return validate<ConfigRegionRuleIfAccountNewerThan & V>(\n v,\n id,\n hashConfigRegionRuleIfAccountNewerThan,\n )\n}\n\n/** Age Assurance rule that applies if the account is older than a certain date. */\nexport interface ConfigRegionRuleIfAccountOlderThan {\n $type?: 'app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan'\n /** The date threshold as a datetime string. */\n date: string\n access: Access\n}\n\nconst hashConfigRegionRuleIfAccountOlderThan =\n 'configRegionRuleIfAccountOlderThan'\n\nexport function isConfigRegionRuleIfAccountOlderThan<V>(v: V) {\n return is$typed(v, id, hashConfigRegionRuleIfAccountOlderThan)\n}\n\nexport function validateConfigRegionRuleIfAccountOlderThan<V>(v: V) {\n return validate<ConfigRegionRuleIfAccountOlderThan & V>(\n v,\n id,\n hashConfigRegionRuleIfAccountOlderThan,\n )\n}\n\n/** Object used to store Age Assurance data in stash. */\nexport interface Event {\n $type?: 'app.bsky.ageassurance.defs#event'\n /** The date and time of this write operation. */\n createdAt: string\n /** The unique identifier for this instance of the Age Assurance flow, in UUID format. */\n attemptId: string\n /** The status of the Age Assurance process. */\n status: 'unknown' | 'pending' | 'assured' | 'blocked' | (string & {})\n /** The access level granted based on Age Assurance data we've processed. */\n access: 'unknown' | 'none' | 'safe' | 'full' | (string & {})\n /** The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow. */\n countryCode: string\n /** The ISO 3166-2 region code provided when beginning the Age Assurance flow. */\n regionCode?: string\n /** The email used for Age Assurance. */\n email?: string\n /** The IP address used when initiating the Age Assurance flow. */\n initIp?: string\n /** The user agent used when initiating the Age Assurance flow. */\n initUa?: string\n /** The IP address used when completing the Age Assurance flow. */\n completeIp?: string\n /** The user agent used when completing the Age Assurance flow. */\n completeUa?: string\n}\n\nconst hashEvent = 'event'\n\nexport function isEvent<V>(v: V) {\n return is$typed(v, id, hashEvent)\n}\n\nexport function validateEvent<V>(v: V) {\n return validate<Event & V>(v, id, hashEvent)\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type * as AppBskyAgeassuranceDefs from './defs.js';
2
+ export type QueryParams = {};
3
+ export type InputSchema = undefined;
4
+ export type OutputSchema = AppBskyAgeassuranceDefs.Config;
5
+ export type HandlerInput = void;
6
+ export interface HandlerSuccess {
7
+ encoding: 'application/json';
8
+ body: OutputSchema;
9
+ headers?: {
10
+ [key: string]: string;
11
+ };
12
+ }
13
+ export interface HandlerError {
14
+ status: number;
15
+ message?: string;
16
+ }
17
+ export type HandlerOutput = HandlerError | HandlerSuccess;
18
+ //# sourceMappingURL=getConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/getConfig.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,uBAAuB,MAAM,WAAW,CAAA;AAMzD,MAAM,MAAM,WAAW,GAAG,EAAE,CAAA;AAC5B,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AACnC,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAC,MAAM,CAAA;AACzD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAA;AAE/B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lexicons_1 = require("../../../../lexicons");
4
+ const util_1 = require("../../../../util");
5
+ const is$typed = util_1.is$typed, validate = lexicons_1.validate;
6
+ const id = 'app.bsky.ageassurance.getConfig';
7
+ //# sourceMappingURL=getConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/getConfig.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,iCAAiC,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\nimport type * as AppBskyAgeassuranceDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.ageassurance.getConfig'\n\nexport type QueryParams = {}\nexport type InputSchema = undefined\nexport type OutputSchema = AppBskyAgeassuranceDefs.Config\nexport type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
@@ -0,0 +1,24 @@
1
+ import type * as AppBskyAgeassuranceDefs from './defs.js';
2
+ export type QueryParams = {
3
+ countryCode: string;
4
+ regionCode?: string;
5
+ };
6
+ export type InputSchema = undefined;
7
+ export interface OutputSchema {
8
+ state: AppBskyAgeassuranceDefs.State;
9
+ metadata: AppBskyAgeassuranceDefs.StateMetadata;
10
+ }
11
+ export type HandlerInput = void;
12
+ export interface HandlerSuccess {
13
+ encoding: 'application/json';
14
+ body: OutputSchema;
15
+ headers?: {
16
+ [key: string]: string;
17
+ };
18
+ }
19
+ export interface HandlerError {
20
+ status: number;
21
+ message?: string;
22
+ }
23
+ export type HandlerOutput = HandlerError | HandlerSuccess;
24
+ //# sourceMappingURL=getState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getState.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/getState.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,uBAAuB,MAAM,WAAW,CAAA;AAMzD,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAA;IACpC,QAAQ,EAAE,uBAAuB,CAAC,aAAa,CAAA;CAChD;AAED,MAAM,MAAM,YAAY,GAAG,IAAI,CAAA;AAE/B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lexicons_1 = require("../../../../lexicons");
4
+ const util_1 = require("../../../../util");
5
+ const is$typed = util_1.is$typed, validate = lexicons_1.validate;
6
+ const id = 'app.bsky.ageassurance.getState';
7
+ //# sourceMappingURL=getState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getState.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/ageassurance/getState.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,gCAAgC,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\nimport type * as AppBskyAgeassuranceDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.ageassurance.getState'\n\nexport type QueryParams = {\n countryCode: string\n regionCode?: string\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n state: AppBskyAgeassuranceDefs.State\n metadata: AppBskyAgeassuranceDefs.StateMetadata\n}\n\nexport type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stash.d.ts","sourceRoot":"","sources":["../src/stash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAYrC,eAAO,MAAM,UAAU;;;;;CAStB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AAEpE,eAAO,MAAM,iBAAiB,GAAI,aAAa,WAAW,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IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,QAAQ,CAAA;CAClB,CAAA;AAED,KAAK,WAAW,GAAG,WAAW,CAAA;AAE9B,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA"}
package/dist/stash.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ /* eslint-disable import/no-deprecated */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.StashClient = exports.createStashClient = exports.Namespaces = void 0;
4
5
  const lexicon_1 = require("@atproto/lexicon");
package/dist/stash.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stash.js","sourceRoot":"","sources":["../src/stash.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAEzD,iDAA6C;AAO7C,+CAAyC;AAI5B,QAAA,UAAU,GAAG;IACxB,2BAA2B,EACzB,iCAA8D;IAChE,kCAAkC,EAChC,wCAAwE;IAC1E,kDAAkD,EAChD,wDAAwG;IAC1G,qCAAqC,EACnC,2CAAiF;CACpF,CAAA;AAIM,MAAM,iBAAiB,GAAG,CAAC,WAAwB,EAAe,EAAE;IACzE,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAA;AACrC,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AAED,8EAA8E;AAC9E,2FAA2F;AAC3F,MAAa,WAAW;IACtB,YAA6B,WAAwB;QAAzC;;;;mBAAiB,WAAW;WAAa;IAAG,CAAC;IAEzD,MAAM,CAAC,KAAkB;QACvB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,CAAC,KAAkB;QACvB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,CAAC,KAAkB;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAM,CAAC,MAAM,EAAE,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;IAC3E,CAAC;IAEO,eAAe,CAAC,SAAoB,EAAE,OAAiB;QAC7D,MAAM,MAAM,GAAG,mBAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,MAAM,CAAC,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,KAAwB;QACjE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;QACnD,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;YAClC,QAAQ;YACR,SAAS;YACT,GAAG;YACH,MAAM;YACN,OAAO,EAAE,OAAO;gBACd,CAAC,CAAC,MAAM,CAAC,IAAI,CACT,IAAA,sBAAY,EAAC;oBACX,KAAK,EAAE,SAAS;oBAChB,GAAG,OAAO;iBACX,CAAC,CACH;gBACH,CAAC,CAAC,SAAS;SACd,CAAC,CAAA;IACJ,CAAC;CACF;AAzCD,kCAyCC","sourcesContent":["import { LexValue, stringifyLex } from '@atproto/lexicon'\nimport { BsyncClient } from './bsync'\nimport { lexicons } from './lexicon/lexicons'\nimport { Bookmark } from './lexicon/types/app/bsky/bookmark/defs'\nimport {\n Preferences,\n SubjectActivitySubscription,\n} from './lexicon/types/app/bsky/notification/defs'\nimport { AgeAssuranceEvent } from './lexicon/types/app/bsky/unspecced/defs'\nimport { Method } from './proto/bsync_pb'\n\ntype PickNSID<T extends { $type?: string }> = Exclude<T['$type'], undefined>\n\nexport const Namespaces = {\n AppBskyBookmarkDefsBookmark:\n 'app.bsky.bookmark.defs#bookmark' satisfies PickNSID<Bookmark>,\n AppBskyNotificationDefsPreferences:\n 'app.bsky.notification.defs#preferences' satisfies PickNSID<Preferences>,\n AppBskyNotificationDefsSubjectActivitySubscription:\n 'app.bsky.notification.defs#subjectActivitySubscription' satisfies PickNSID<SubjectActivitySubscription>,\n AppBskyUnspeccedDefsAgeAssuranceEvent:\n 'app.bsky.unspecced.defs#ageAssuranceEvent' satisfies PickNSID<AgeAssuranceEvent>,\n}\n\nexport type Namespace = (typeof Namespaces)[keyof typeof Namespaces]\n\nexport const createStashClient = (bsyncClient: BsyncClient): StashClient => {\n return new StashClient(bsyncClient)\n}\n\n// An abstraction over the BsyncClient, that uses the bsync `PutOperation` RPC\n// to store private data, which can be indexed by the dataplane and queried by the appview.\nexport class StashClient {\n constructor(private readonly bsyncClient: BsyncClient) {}\n\n create(input: CreateInput) {\n this.validateLexicon(input.namespace, input.payload)\n return this.putOperation(Method.CREATE, input)\n }\n\n update(input: UpdateInput) {\n this.validateLexicon(input.namespace, input.payload)\n return this.putOperation(Method.UPDATE, input)\n }\n\n delete(input: DeleteInput) {\n return this.putOperation(Method.DELETE, { ...input, payload: undefined })\n }\n\n private validateLexicon(namespace: Namespace, payload: LexValue) {\n const result = lexicons.validate(namespace, payload)\n if (!result.success) {\n throw result.error\n }\n }\n\n private async putOperation(method: Method, input: PutOperationInput) {\n const { actorDid, namespace, key, payload } = input\n await this.bsyncClient.putOperation({\n actorDid,\n namespace,\n key,\n method,\n payload: payload\n ? Buffer.from(\n stringifyLex({\n $type: namespace,\n ...payload,\n }),\n )\n : undefined,\n })\n }\n}\n\ntype PutOperationInput = {\n actorDid: string\n namespace: Namespace\n key: string\n payload: LexValue | undefined\n}\n\ntype CreateInput = {\n actorDid: string\n namespace: Namespace\n key: string\n payload: LexValue\n}\n\ntype UpdateInput = CreateInput\n\ntype DeleteInput = {\n actorDid: string\n namespace: Namespace\n key: string\n}\n"]}
1
+ {"version":3,"file":"stash.js","sourceRoot":"","sources":["../src/stash.ts"],"names":[],"mappings":";AAAA,yCAAyC;;;AAEzC,8CAAyD;AAEzD,iDAA6C;AAO7C,+CAAyC;AAI5B,QAAA,UAAU,GAAG;IACxB,2BAA2B,EACzB,iCAA8D;IAChE,kCAAkC,EAChC,wCAAwE;IAC1E,kDAAkD,EAChD,wDAAwG;IAC1G,qCAAqC,EACnC,2CAAiF;CACpF,CAAA;AAIM,MAAM,iBAAiB,GAAG,CAAC,WAAwB,EAAe,EAAE;IACzE,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAA;AACrC,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AAED,8EAA8E;AAC9E,2FAA2F;AAC3F,MAAa,WAAW;IACtB,YAA6B,WAAwB;QAAzC;;;;mBAAiB,WAAW;WAAa;IAAG,CAAC;IAEzD,MAAM,CAAC,KAAkB;QACvB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,CAAC,KAAkB;QACvB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,CAAC,KAAkB;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAM,CAAC,MAAM,EAAE,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;IAC3E,CAAC;IAEO,eAAe,CAAC,SAAoB,EAAE,OAAiB;QAC7D,MAAM,MAAM,GAAG,mBAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,MAAM,CAAC,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,KAAwB;QACjE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;QACnD,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;YAClC,QAAQ;YACR,SAAS;YACT,GAAG;YACH,MAAM;YACN,OAAO,EAAE,OAAO;gBACd,CAAC,CAAC,MAAM,CAAC,IAAI,CACT,IAAA,sBAAY,EAAC;oBACX,KAAK,EAAE,SAAS;oBAChB,GAAG,OAAO;iBACX,CAAC,CACH;gBACH,CAAC,CAAC,SAAS;SACd,CAAC,CAAA;IACJ,CAAC;CACF;AAzCD,kCAyCC","sourcesContent":["/* eslint-disable import/no-deprecated */\n\nimport { LexValue, stringifyLex } from '@atproto/lexicon'\nimport { BsyncClient } from './bsync'\nimport { lexicons } from './lexicon/lexicons'\nimport { Bookmark } from './lexicon/types/app/bsky/bookmark/defs'\nimport {\n Preferences,\n SubjectActivitySubscription,\n} from './lexicon/types/app/bsky/notification/defs'\nimport { AgeAssuranceEvent } from './lexicon/types/app/bsky/unspecced/defs'\nimport { Method } from './proto/bsync_pb'\n\ntype PickNSID<T extends { $type?: string }> = Exclude<T['$type'], undefined>\n\nexport const Namespaces = {\n AppBskyBookmarkDefsBookmark:\n 'app.bsky.bookmark.defs#bookmark' satisfies PickNSID<Bookmark>,\n AppBskyNotificationDefsPreferences:\n 'app.bsky.notification.defs#preferences' satisfies PickNSID<Preferences>,\n AppBskyNotificationDefsSubjectActivitySubscription:\n 'app.bsky.notification.defs#subjectActivitySubscription' satisfies PickNSID<SubjectActivitySubscription>,\n AppBskyUnspeccedDefsAgeAssuranceEvent:\n 'app.bsky.unspecced.defs#ageAssuranceEvent' satisfies PickNSID<AgeAssuranceEvent>,\n}\n\nexport type Namespace = (typeof Namespaces)[keyof typeof Namespaces]\n\nexport const createStashClient = (bsyncClient: BsyncClient): StashClient => {\n return new StashClient(bsyncClient)\n}\n\n// An abstraction over the BsyncClient, that uses the bsync `PutOperation` RPC\n// to store private data, which can be indexed by the dataplane and queried by the appview.\nexport class StashClient {\n constructor(private readonly bsyncClient: BsyncClient) {}\n\n create(input: CreateInput) {\n this.validateLexicon(input.namespace, input.payload)\n return this.putOperation(Method.CREATE, input)\n }\n\n update(input: UpdateInput) {\n this.validateLexicon(input.namespace, input.payload)\n return this.putOperation(Method.UPDATE, input)\n }\n\n delete(input: DeleteInput) {\n return this.putOperation(Method.DELETE, { ...input, payload: undefined })\n }\n\n private validateLexicon(namespace: Namespace, payload: LexValue) {\n const result = lexicons.validate(namespace, payload)\n if (!result.success) {\n throw result.error\n }\n }\n\n private async putOperation(method: Method, input: PutOperationInput) {\n const { actorDid, namespace, key, payload } = input\n await this.bsyncClient.putOperation({\n actorDid,\n namespace,\n key,\n method,\n payload: payload\n ? Buffer.from(\n stringifyLex({\n $type: namespace,\n ...payload,\n }),\n )\n : undefined,\n })\n }\n}\n\ntype PutOperationInput = {\n actorDid: string\n namespace: Namespace\n key: string\n payload: LexValue | undefined\n}\n\ntype CreateInput = {\n actorDid: string\n namespace: Namespace\n key: string\n payload: LexValue\n}\n\ntype UpdateInput = CreateInput\n\ntype DeleteInput = {\n actorDid: string\n namespace: Namespace\n key: string\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/bsky",
3
- "version": "0.0.197",
3
+ "version": "0.0.198",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of app.bsky App View (Bluesky API)",
6
6
  "keywords": [
@@ -52,17 +52,17 @@
52
52
  "undici": "^6.19.8",
53
53
  "zod": "3.23.8",
54
54
  "@atproto-labs/fetch-node": "0.2.0",
55
- "@atproto-labs/xrpc-utils": "0.0.23",
56
- "@atproto/api": "^0.18.1",
57
- "@atproto/common": "^0.4.12",
55
+ "@atproto-labs/xrpc-utils": "0.0.24",
56
+ "@atproto/api": "^0.18.2",
57
+ "@atproto/common": "^0.5.0",
58
58
  "@atproto/crypto": "^0.4.4",
59
- "@atproto/did": "^0.2.1",
60
- "@atproto/identity": "^0.4.9",
61
- "@atproto/lexicon": "^0.5.1",
62
- "@atproto/repo": "^0.8.10",
63
- "@atproto/sync": "^0.1.37",
59
+ "@atproto/did": "^0.2.2",
60
+ "@atproto/identity": "^0.4.10",
61
+ "@atproto/lexicon": "^0.5.2",
62
+ "@atproto/repo": "^0.8.11",
63
+ "@atproto/sync": "^0.1.38",
64
64
  "@atproto/syntax": "^0.4.1",
65
- "@atproto/xrpc-server": "^0.9.6"
65
+ "@atproto/xrpc-server": "^0.10.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@bufbuild/buf": "^1.28.1",
@@ -77,10 +77,10 @@
77
77
  "jest": "^28.1.2",
78
78
  "ts-node": "^10.8.2",
79
79
  "typescript": "^5.6.3",
80
- "@atproto/api": "^0.18.1",
81
- "@atproto/lex-cli": "^0.9.6",
82
- "@atproto/pds": "^0.4.194",
83
- "@atproto/xrpc": "^0.7.5"
80
+ "@atproto/api": "^0.18.2",
81
+ "@atproto/lex-cli": "^0.9.7",
82
+ "@atproto/pds": "^0.4.195",
83
+ "@atproto/xrpc": "^0.7.6"
84
84
  },
85
85
  "scripts": {
86
86
  "codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/*",
@@ -17,6 +17,9 @@ import * as AppBskyActorGetSuggestions from './types/app/bsky/actor/getSuggestio
17
17
  import * as AppBskyActorPutPreferences from './types/app/bsky/actor/putPreferences.js'
18
18
  import * as AppBskyActorSearchActors from './types/app/bsky/actor/searchActors.js'
19
19
  import * as AppBskyActorSearchActorsTypeahead from './types/app/bsky/actor/searchActorsTypeahead.js'
20
+ import * as AppBskyAgeassuranceBegin from './types/app/bsky/ageassurance/begin.js'
21
+ import * as AppBskyAgeassuranceGetConfig from './types/app/bsky/ageassurance/getConfig.js'
22
+ import * as AppBskyAgeassuranceGetState from './types/app/bsky/ageassurance/getState.js'
20
23
  import * as AppBskyBookmarkCreateBookmark from './types/app/bsky/bookmark/createBookmark.js'
21
24
  import * as AppBskyBookmarkDeleteBookmark from './types/app/bsky/bookmark/deleteBookmark.js'
22
25
  import * as AppBskyBookmarkGetBookmarks from './types/app/bsky/bookmark/getBookmarks.js'
@@ -271,6 +274,7 @@ export class AppNS {
271
274
  export class AppBskyNS {
272
275
  _server: Server
273
276
  actor: AppBskyActorNS
277
+ ageassurance: AppBskyAgeassuranceNS
274
278
  bookmark: AppBskyBookmarkNS
275
279
  embed: AppBskyEmbedNS
276
280
  feed: AppBskyFeedNS
@@ -284,6 +288,7 @@ export class AppBskyNS {
284
288
  constructor(server: Server) {
285
289
  this._server = server
286
290
  this.actor = new AppBskyActorNS(server)
291
+ this.ageassurance = new AppBskyAgeassuranceNS(server)
287
292
  this.bookmark = new AppBskyBookmarkNS(server)
288
293
  this.embed = new AppBskyEmbedNS(server)
289
294
  this.feed = new AppBskyFeedNS(server)
@@ -388,6 +393,50 @@ export class AppBskyActorNS {
388
393
  }
389
394
  }
390
395
 
396
+ export class AppBskyAgeassuranceNS {
397
+ _server: Server
398
+
399
+ constructor(server: Server) {
400
+ this._server = server
401
+ }
402
+
403
+ begin<A extends Auth = void>(
404
+ cfg: MethodConfigOrHandler<
405
+ A,
406
+ AppBskyAgeassuranceBegin.QueryParams,
407
+ AppBskyAgeassuranceBegin.HandlerInput,
408
+ AppBskyAgeassuranceBegin.HandlerOutput
409
+ >,
410
+ ) {
411
+ const nsid = 'app.bsky.ageassurance.begin' // @ts-ignore
412
+ return this._server.xrpc.method(nsid, cfg)
413
+ }
414
+
415
+ getConfig<A extends Auth = void>(
416
+ cfg: MethodConfigOrHandler<
417
+ A,
418
+ AppBskyAgeassuranceGetConfig.QueryParams,
419
+ AppBskyAgeassuranceGetConfig.HandlerInput,
420
+ AppBskyAgeassuranceGetConfig.HandlerOutput
421
+ >,
422
+ ) {
423
+ const nsid = 'app.bsky.ageassurance.getConfig' // @ts-ignore
424
+ return this._server.xrpc.method(nsid, cfg)
425
+ }
426
+
427
+ getState<A extends Auth = void>(
428
+ cfg: MethodConfigOrHandler<
429
+ A,
430
+ AppBskyAgeassuranceGetState.QueryParams,
431
+ AppBskyAgeassuranceGetState.HandlerInput,
432
+ AppBskyAgeassuranceGetState.HandlerOutput
433
+ >,
434
+ ) {
435
+ const nsid = 'app.bsky.ageassurance.getState' // @ts-ignore
436
+ return this._server.xrpc.method(nsid, cfg)
437
+ }
438
+ }
439
+
391
440
  export class AppBskyBookmarkNS {
392
441
  _server: Server
393
442