@atproto/lexicon 0.2.3 → 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.
- package/CHANGELOG.md +14 -0
- package/LICENSE.txt +7 -0
- package/README.md +6 -1
- package/dist/index.js +10 -25
- package/dist/index.js.map +2 -2
- package/dist/lexicons.d.ts +2 -2
- package/dist/types.d.ts +1 -5
- package/package.json +3 -3
- package/src/lexicons.ts +6 -25
- package/src/types.ts +3 -10
- package/tests/_scaffolds/lexicons.ts +5 -1
- package/tests/general.test.ts +6 -6
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atproto/lexicon
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1801](https://github.com/bluesky-social/atproto/pull/1801) [`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89) Thanks [@gaearon](https://github.com/gaearon)! - Methods that accepts lexicons now take `LexiconDoc` type instead of `unknown`
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2"
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]:
|
|
14
|
+
- @atproto/common-web@0.2.3
|
|
15
|
+
- @atproto/syntax@0.1.4
|
|
16
|
+
|
|
3
17
|
## 0.2.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Dual MIT/Apache-2.0 License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2023 Bluesky PBC, and Contributors
|
|
4
|
+
|
|
5
|
+
Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
|
|
6
|
+
|
|
7
|
+
Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
|
package/README.md
CHANGED
|
@@ -31,4 +31,9 @@ lex.assertValidXrpcOutput('com.example.query', {...})
|
|
|
31
31
|
|
|
32
32
|
## License
|
|
33
33
|
|
|
34
|
-
MIT
|
|
34
|
+
This project is dual-licensed under MIT and Apache 2.0 terms:
|
|
35
|
+
|
|
36
|
+
- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
|
|
37
|
+
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)
|
|
38
|
+
|
|
39
|
+
Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
|
package/dist/index.js
CHANGED
|
@@ -8872,7 +8872,6 @@ __export(src_exports2, {
|
|
|
8872
8872
|
BlobRef: () => BlobRef,
|
|
8873
8873
|
InvalidLexiconError: () => InvalidLexiconError,
|
|
8874
8874
|
LexiconDefNotFoundError: () => LexiconDefNotFoundError,
|
|
8875
|
-
LexiconDocMalformedError: () => LexiconDocMalformedError,
|
|
8876
8875
|
Lexicons: () => Lexicons,
|
|
8877
8876
|
ValidationError: () => ValidationError,
|
|
8878
8877
|
discriminatedObject: () => discriminatedObject,
|
|
@@ -8913,6 +8912,7 @@ __export(src_exports2, {
|
|
|
8913
8912
|
lexXrpcSubscription: () => lexXrpcSubscription,
|
|
8914
8913
|
lexXrpcSubscriptionMessage: () => lexXrpcSubscriptionMessage,
|
|
8915
8914
|
lexiconDoc: () => lexiconDoc,
|
|
8915
|
+
parseLexiconDoc: () => parseLexiconDoc,
|
|
8916
8916
|
stringifyLex: () => stringifyLex,
|
|
8917
8917
|
typedJsonBlobRef: () => typedJsonBlobRef,
|
|
8918
8918
|
untypedJsonBlobRef: () => untypedJsonBlobRef
|
|
@@ -14783,15 +14783,10 @@ var discriminatedObject = z.object({ $type: z.string() });
|
|
|
14783
14783
|
function isDiscriminatedObject(value) {
|
|
14784
14784
|
return discriminatedObject.safeParse(value).success;
|
|
14785
14785
|
}
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
this.issues = issues;
|
|
14791
|
-
this.schemaDef = schemaDef;
|
|
14792
|
-
this.issues = issues;
|
|
14793
|
-
}
|
|
14794
|
-
};
|
|
14786
|
+
function parseLexiconDoc(v) {
|
|
14787
|
+
lexiconDoc.parse(v);
|
|
14788
|
+
return v;
|
|
14789
|
+
}
|
|
14795
14790
|
var ValidationError = class extends Error {
|
|
14796
14791
|
};
|
|
14797
14792
|
var InvalidLexiconError = class extends Error {
|
|
@@ -14872,23 +14867,13 @@ var Lexicons = class {
|
|
|
14872
14867
|
}
|
|
14873
14868
|
}
|
|
14874
14869
|
add(doc) {
|
|
14875
|
-
|
|
14876
|
-
lexiconDoc.parse(doc);
|
|
14877
|
-
} catch (e) {
|
|
14878
|
-
if (e instanceof ZodError) {
|
|
14879
|
-
throw new LexiconDocMalformedError(`Failed to parse schema definition ${doc.id}`, doc, e.issues);
|
|
14880
|
-
} else {
|
|
14881
|
-
throw e;
|
|
14882
|
-
}
|
|
14883
|
-
}
|
|
14884
|
-
const validatedDoc = doc;
|
|
14885
|
-
const uri2 = toLexUri(validatedDoc.id);
|
|
14870
|
+
const uri2 = toLexUri(doc.id);
|
|
14886
14871
|
if (this.docs.has(uri2)) {
|
|
14887
14872
|
throw new Error(`${uri2} has already been registered`);
|
|
14888
14873
|
}
|
|
14889
|
-
resolveRefUris(
|
|
14890
|
-
this.docs.set(uri2,
|
|
14891
|
-
for (const [defUri, def2] of iterDefs(
|
|
14874
|
+
resolveRefUris(doc, uri2);
|
|
14875
|
+
this.docs.set(uri2, doc);
|
|
14876
|
+
for (const [defUri, def2] of iterDefs(doc)) {
|
|
14892
14877
|
this.defs.set(defUri, def2);
|
|
14893
14878
|
}
|
|
14894
14879
|
}
|
|
@@ -15065,7 +15050,6 @@ var jsonStringToLex = (val) => {
|
|
|
15065
15050
|
BlobRef,
|
|
15066
15051
|
InvalidLexiconError,
|
|
15067
15052
|
LexiconDefNotFoundError,
|
|
15068
|
-
LexiconDocMalformedError,
|
|
15069
15053
|
Lexicons,
|
|
15070
15054
|
ValidationError,
|
|
15071
15055
|
discriminatedObject,
|
|
@@ -15106,6 +15090,7 @@ var jsonStringToLex = (val) => {
|
|
|
15106
15090
|
lexXrpcSubscription,
|
|
15107
15091
|
lexXrpcSubscriptionMessage,
|
|
15108
15092
|
lexiconDoc,
|
|
15093
|
+
parseLexiconDoc,
|
|
15109
15094
|
stringifyLex,
|
|
15110
15095
|
typedJsonBlobRef,
|
|
15111
15096
|
untypedJsonBlobRef
|