@seedprotocol/licensing 0.0.0-stage → 0.8.3

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 (50) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +60 -2
  3. package/dist/canonicalJson.d.ts +11 -0
  4. package/dist/canonicalJson.d.ts.map +1 -0
  5. package/dist/catalog/cc/chooser.d.ts +4 -0
  6. package/dist/catalog/cc/chooser.d.ts.map +1 -0
  7. package/dist/catalog/cc/index.d.ts +3 -0
  8. package/dist/catalog/cc/index.d.ts.map +1 -0
  9. package/dist/catalog/cc/modules.d.ts +4 -0
  10. package/dist/catalog/cc/modules.d.ts.map +1 -0
  11. package/dist/catalog/cc/urls.d.ts +21 -0
  12. package/dist/catalog/cc/urls.d.ts.map +1 -0
  13. package/dist/catalog/cc.js +251 -0
  14. package/dist/catalog/cc.js.map +1 -0
  15. package/dist/catalog/chooser.d.ts +27 -0
  16. package/dist/catalog/chooser.d.ts.map +1 -0
  17. package/dist/catalog/createLicenseCatalog.d.ts +7 -0
  18. package/dist/catalog/createLicenseCatalog.d.ts.map +1 -0
  19. package/dist/catalog/types.d.ts +42 -0
  20. package/dist/catalog/types.d.ts.map +1 -0
  21. package/dist/deed/en.d.ts +10 -0
  22. package/dist/deed/en.d.ts.map +1 -0
  23. package/dist/deed/renderDeed.d.ts +33 -0
  24. package/dist/deed/renderDeed.d.ts.map +1 -0
  25. package/dist/deed/rules.d.ts +19 -0
  26. package/dist/deed/rules.d.ts.map +1 -0
  27. package/dist/deed/summarySentence.d.ts +9 -0
  28. package/dist/deed/summarySentence.d.ts.map +1 -0
  29. package/dist/errors.d.ts +22 -0
  30. package/dist/errors.d.ts.map +1 -0
  31. package/dist/fromUrl.d.ts +7 -0
  32. package/dist/fromUrl.d.ts.map +1 -0
  33. package/dist/hash.d.ts +8 -0
  34. package/dist/hash.d.ts.map +1 -0
  35. package/dist/index.d.ts +19 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +204 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/spdx/list.generated.d.ts +5 -0
  40. package/dist/spdx/list.generated.d.ts.map +1 -0
  41. package/dist/spdx/parse.d.ts +33 -0
  42. package/dist/spdx/parse.d.ts.map +1 -0
  43. package/dist/terms.d.ts +102 -0
  44. package/dist/terms.d.ts.map +1 -0
  45. package/dist/urls-DDyEMdyz.js +337 -0
  46. package/dist/urls-DDyEMdyz.js.map +1 -0
  47. package/dist/validate.d.ts +20 -0
  48. package/dist/validate.d.ts.map +1 -0
  49. package/package.json +72 -4
  50. package/terms.schema.json +174 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented in this file.
4
+
5
+ ## 0.8.3 (2026-11-23)
6
+
7
+ - New package: license terms, `termsHash`, SPDX parsing, the Creative Commons catalog, deeds and the license chooser.
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @seedprotocol/licensing
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ License terms, a catalog of licenses, plain-language deeds and a license chooser for Seed Protocol.
4
+ It doesn't depend on `@seedprotocol/sdk`, so it runs in a browser, a server render or an agent.
5
+
6
+ ```bash
7
+ bun add @seedprotocol/licensing
8
+ ```
9
+
10
+ ## A license picker
11
+
12
+ ```ts
13
+ import { renderDeed, summarySentence } from '@seedprotocol/licensing'
14
+ import { ccChooser } from '@seedprotocol/licensing/catalog/cc'
15
+
16
+ // Draw ccChooser.questions; each choice has an id, a label and `ends` when it settles the answer.
17
+ const choice = ccChooser.resolve({ republish: 'yes', conditions: 'credit', adapt: 'yes', commercial: 'no' })
18
+ // → { spdx: 'CC-BY-NC-4.0', termsHash: '0x…', module }
19
+
20
+ const terms = choice!.module.toTerms()
21
+ summarySentence(terms, { locale: 'en' })
22
+ // 'Anyone may republish and adapt it with credit, but not commercially.'
23
+
24
+ const deed = renderDeed(terms, { locale: 'en', stewardDeedUrl: choice!.module.stewardDeedUrl })
25
+ // deed.youCan, deed.youMust, deed.youCannot, deed.whenTimeRunsOut, deed.creatorPromises: { rule, text }[]
26
+
27
+ ccChooser.answersFor('CC-BY-NC-4.0') // the answers, to redraw a saved choice
28
+ ```
29
+
30
+ The chooser covers CC0 1.0, the six CC BY 4.0 licenses and All rights reserved
31
+ (`LicenseRef-seed-all-rights-reserved-1`).
32
+
33
+ ## Terms and their hash
34
+
35
+ `SeedLicenseTerms` describes what a license permits, prohibits and requires, as a closed ODRL 2.2
36
+ profile. `termsHash(terms)` is the SHA-256 of their RFC 8785 canonical JSON, and is what a
37
+ `licenseOffer` refers to. `validateTerms` checks terms without throwing; `termsHash` throws
38
+ `InvalidLicenseTermsError` on invalid ones. `terms.schema.json` is the same shape as JSON Schema.
39
+ ADR 0034 records what the hash covers.
40
+
41
+ ```ts
42
+ import { createLicenseCatalog, termsHash } from '@seedprotocol/licensing'
43
+ import { creativeCommons } from '@seedprotocol/licensing/catalog/cc'
44
+
45
+ const catalog = createLicenseCatalog(creativeCommons)
46
+ catalog.byTermsHash(hash) // { module, terms } for a hash read from an offer
47
+ catalog.bySpdx('CC0-1.0')
48
+ ```
49
+
50
+ ## SPDX and URLs
51
+
52
+ `parseSpdx(expression)` parses SPDX license expressions against the SPDX License List 3.29.0
53
+ (`SPDX_LIST_VERSION`). `fromUrl(url)` returns the SPDX id a license URL names, such as a Creative
54
+ Commons deed URL found in a feed, or `null`.
55
+
56
+ ## Deeds are drafts
57
+
58
+ Deed and summary sentences are Seed's own wording, not the stewards', and haven't been reviewed by
59
+ counsel: every deed has `reviewed: false`. A deed opens by saying the legal text governs and names
60
+ it by URL and SHA-256. The legal texts are in `legal/` in the repository (not in the npm package);
61
+ `legal/NOTICE.md` says where they come from.
@@ -0,0 +1,11 @@
1
+ import { CanonicalJsonError } from './errors.js';
2
+ export { CanonicalJsonError };
3
+ /**
4
+ * RFC 8785 canonical JSON for the values license terms use: plain objects, arrays, strings, safe
5
+ * integers, booleans and null. Keys sort by UTF-16 code units, which is what `Array.prototype.sort`
6
+ * does; ECMAScript's string serialization is the one RFC 8785 specifies. Non-integer numbers are
7
+ * refused rather than formatted, so the RFC's number rules never come into play. An object
8
+ * property whose value is `undefined` is left out, as `JSON.stringify` does.
9
+ */
10
+ export declare function canonicalJson(value: unknown): string;
11
+ //# sourceMappingURL=canonicalJson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalJson.d.ts","sourceRoot":"","sources":["../src/canonicalJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,4 @@
1
+ import type { Chooser } from '../chooser.js';
2
+ /** The four questions PermaPress's picker asks, resolving to CC0, the six CC BY 4.0 licenses or reserved rights. */
3
+ export declare const ccChooser: Chooser;
4
+ //# sourceMappingURL=chooser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chooser.d.ts","sourceRoot":"","sources":["../../../src/catalog/cc/chooser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,YAAY,CAAA;AA0D1D,oHAAoH;AACpH,eAAO,MAAM,SAAS,EAAE,OAYtB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { creativeCommons } from './modules.js';
2
+ export { ccChooser } from './chooser.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/catalog/cc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { LicenseModule } from '../types.js';
2
+ /** CC0, the six CC BY 4.0 licenses and reserved rights, in the order a picker shows them. */
3
+ export declare const creativeCommons: readonly LicenseModule[];
4
+ //# sourceMappingURL=modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../src/catalog/cc/modules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,aAAa,EAAE,MAAM,UAAU,CAAA;AAqIrD,6FAA6F;AAC7F,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EASlD,CAAA"}
@@ -0,0 +1,21 @@
1
+ /** URLs of the Creative Commons modules, shared by the modules and by `fromUrl` in core. */
2
+ export declare const CC_CODES: readonly ["by", "by-sa", "by-nc", "by-nc-sa", "by-nd", "by-nc-nd"];
3
+ export type CcCode = (typeof CC_CODES)[number];
4
+ export declare const ccSpdx: (code: CcCode) => string;
5
+ export declare const ccUrls: (code: CcCode) => {
6
+ iri: string;
7
+ canonicalUrl: string;
8
+ stewardDeedUrl: string;
9
+ };
10
+ export declare const CC0_URLS: {
11
+ iri: string;
12
+ canonicalUrl: string;
13
+ stewardDeedUrl: string;
14
+ };
15
+ export declare const RESERVED_SPDX = "LicenseRef-seed-all-rights-reserved-1";
16
+ export declare const RESERVED_URLS: {
17
+ canonicalUrl: string;
18
+ };
19
+ /** Every module URL (IRI and legal text) to the module's SPDX id. */
20
+ export declare function catalogUrlTable(): Map<string, string>;
21
+ //# sourceMappingURL=urls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../../src/catalog/cc/urls.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,eAAO,MAAM,QAAQ,oEAAqE,CAAA;AAC1F,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9C,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,WAAmC,CAAA;AAEtE,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM;;;;CAGlC,CAAA;AAED,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AAED,eAAO,MAAM,aAAa,0CAA0C,CAAA;AACpE,eAAO,MAAM,aAAa;;CAGzB,CAAA;AAED,qEAAqE;AACrE,wBAAgB,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAWrD"}
@@ -0,0 +1,251 @@
1
+ import { a as e, l as t, n, o as r, r as i, s as a, t as o } from "../urls-DDyEMdyz.js";
2
+ //#region src/catalog/cc/modules.ts
3
+ var s = {
4
+ "CC0-1.0": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499",
5
+ "CC-BY-4.0": "d557539df68e771cc1eedcc91d13f70fca930e508d11eedcafa4b15db49e3744",
6
+ "CC-BY-SA-4.0": "cde7883b9050a1104f4ac19a1572aafd6e5d7323b68351aaf51fbf4beba54966",
7
+ "CC-BY-NC-4.0": "cc97a2c4ff7723a1f25179dc7c18f676fa84191bbb36ea7d0061acaf3c102559",
8
+ "CC-BY-NC-SA-4.0": "600ca4e25fe11762b75a97e714707fab48bb778374e92d24c6ca068791661c11",
9
+ "CC-BY-ND-4.0": "4a9d465e981ae6bde7f117abbfb0e24f2cc1820e99a47efbe58593fa5c43fa29",
10
+ "CC-BY-NC-ND-4.0": "4f3c4a321eb0c73182eee7afa3fe0111e24dec193f2d6febcf4207f26af26839",
11
+ [n]: "e11f4786261aa29fffcbf5c8d51264b2463c285000ca284d9ec6ac627607dd8a"
12
+ }, c = Object.freeze([
13
+ "media",
14
+ "news",
15
+ "academic",
16
+ "data"
17
+ ]), l = Object.freeze([
18
+ "software",
19
+ "media",
20
+ "data",
21
+ "ai-model",
22
+ "font",
23
+ "hardware",
24
+ "news",
25
+ "academic"
26
+ ]), u = Object.freeze({
27
+ name: "Creative Commons",
28
+ url: "https://creativecommons.org"
29
+ }), d = {
30
+ by: "Attribution",
31
+ "by-sa": "Attribution-ShareAlike",
32
+ "by-nc": "Attribution-NonCommercial",
33
+ "by-nc-sa": "Attribution-NonCommercial-ShareAlike",
34
+ "by-nd": "Attribution-NoDerivatives",
35
+ "by-nc-nd": "Attribution-NonCommercial-NoDerivatives"
36
+ };
37
+ function f(e, t) {
38
+ return Object.freeze({
39
+ canonicalUrl: t,
40
+ sha256: s[e],
41
+ lang: "en"
42
+ });
43
+ }
44
+ function p(n) {
45
+ let i = n.includes("nc"), a = n.includes("nd"), o = n.includes("sa"), s = [
46
+ { action: "reproduce" },
47
+ { action: "distribute" },
48
+ { action: "derive" }
49
+ ];
50
+ a || s.push({
51
+ action: "distribute",
52
+ target: "adaptation"
53
+ }), i || s.push({ action: "commercialize" });
54
+ let c = [];
55
+ a && c.push({
56
+ action: "distribute",
57
+ target: "adaptation"
58
+ }), i && c.push({ action: "commercialize" });
59
+ let l = [{ duty: "attribute" }, { duty: "includeNotice" }];
60
+ o && l.push({ duty: "shareAlike" });
61
+ let u = e(n);
62
+ return {
63
+ profile: t,
64
+ spdx: u,
65
+ legal: { ...f(u, r(n).canonicalUrl) },
66
+ permissions: s,
67
+ prohibitions: c,
68
+ duties: l,
69
+ grant: {
70
+ transferable: !1,
71
+ sublicensable: !1,
72
+ exclusive: !1,
73
+ revocableFor: "breach-only",
74
+ warranty: "as-is",
75
+ duration: "copyright-term"
76
+ }
77
+ };
78
+ }
79
+ function m(t) {
80
+ let n = r(t), i = e(t);
81
+ return Object.freeze({
82
+ id: `cc-${t}@4.0.0`,
83
+ spdx: i,
84
+ name: `Creative Commons ${d[t]} 4.0 International`,
85
+ shortName: `CC ${t.toUpperCase()} 4.0`,
86
+ iri: n.iri,
87
+ domains: c,
88
+ steward: u,
89
+ legal: f(i, n.canonicalUrl),
90
+ stewardDeedUrl: n.stewardDeedUrl,
91
+ warnings: Object.freeze(t.includes("nc") ? ["irrevocable", "nc-ambiguity"] : ["irrevocable"]),
92
+ toTerms: () => p(t)
93
+ });
94
+ }
95
+ var h = Object.freeze({
96
+ id: "cc0@1.0.0",
97
+ spdx: "CC0-1.0",
98
+ name: "Creative Commons Zero v1.0 Universal",
99
+ shortName: "CC0 1.0",
100
+ iri: o.iri,
101
+ domains: c,
102
+ steward: u,
103
+ legal: f("CC0-1.0", o.canonicalUrl),
104
+ stewardDeedUrl: o.stewardDeedUrl,
105
+ warnings: Object.freeze(["irrevocable"]),
106
+ toTerms: () => ({
107
+ profile: t,
108
+ spdx: "CC0-1.0",
109
+ legal: { ...f("CC0-1.0", o.canonicalUrl) },
110
+ permissions: [
111
+ { action: "use" },
112
+ { action: "reproduce" },
113
+ { action: "distribute" },
114
+ { action: "derive" },
115
+ {
116
+ action: "distribute",
117
+ target: "adaptation"
118
+ },
119
+ { action: "commercialize" }
120
+ ],
121
+ prohibitions: [],
122
+ duties: [],
123
+ grant: {
124
+ transferable: !1,
125
+ sublicensable: !1,
126
+ exclusive: !1,
127
+ revocableFor: "never",
128
+ warranty: "as-is",
129
+ duration: "copyright-term"
130
+ }
131
+ })
132
+ }), g = Object.freeze({
133
+ id: "all-rights-reserved@1.0.0",
134
+ spdx: n,
135
+ name: "All rights reserved",
136
+ shortName: "All rights reserved",
137
+ iri: i.canonicalUrl,
138
+ domains: l,
139
+ steward: Object.freeze({
140
+ name: "Seed Protocol",
141
+ url: "https://seedprotocol.io"
142
+ }),
143
+ legal: f(n, i.canonicalUrl),
144
+ toTerms: () => ({
145
+ profile: t,
146
+ spdx: n,
147
+ legal: { ...f(n, i.canonicalUrl) },
148
+ permissions: [],
149
+ prohibitions: [],
150
+ duties: [],
151
+ grant: {
152
+ transferable: !1,
153
+ sublicensable: !1,
154
+ exclusive: !1,
155
+ revocableFor: "never",
156
+ warranty: "as-is",
157
+ duration: "copyright-term"
158
+ }
159
+ })
160
+ }), _ = Object.freeze([
161
+ h,
162
+ m("by"),
163
+ m("by-sa"),
164
+ m("by-nc"),
165
+ m("by-nc-sa"),
166
+ m("by-nd"),
167
+ m("by-nc-nd"),
168
+ g
169
+ ]), v = Object.freeze([
170
+ {
171
+ id: "republish",
172
+ prompt: "May others republish it?",
173
+ choices: [{
174
+ id: "yes",
175
+ label: "Yes"
176
+ }, {
177
+ id: "no",
178
+ label: "No",
179
+ ends: !0
180
+ }]
181
+ },
182
+ {
183
+ id: "conditions",
184
+ prompt: "With credit, or with no conditions?",
185
+ choices: [{
186
+ id: "credit",
187
+ label: "With credit"
188
+ }, {
189
+ id: "none",
190
+ label: "No conditions",
191
+ ends: !0
192
+ }]
193
+ },
194
+ {
195
+ id: "adapt",
196
+ prompt: "May they change it?",
197
+ choices: [
198
+ {
199
+ id: "yes",
200
+ label: "Yes"
201
+ },
202
+ {
203
+ id: "shareAlike",
204
+ label: "Yes, if they share alike"
205
+ },
206
+ {
207
+ id: "no",
208
+ label: "No"
209
+ }
210
+ ]
211
+ },
212
+ {
213
+ id: "commercial",
214
+ prompt: "May they use it commercially?",
215
+ choices: [{
216
+ id: "yes",
217
+ label: "Yes"
218
+ }, {
219
+ id: "no",
220
+ label: "No"
221
+ }]
222
+ }
223
+ ]), y = {
224
+ "republish=no": n,
225
+ "republish=yes&conditions=none": "CC0-1.0",
226
+ "republish=yes&conditions=credit&adapt=yes&commercial=yes": "CC-BY-4.0",
227
+ "republish=yes&conditions=credit&adapt=shareAlike&commercial=yes": "CC-BY-SA-4.0",
228
+ "republish=yes&conditions=credit&adapt=no&commercial=yes": "CC-BY-ND-4.0",
229
+ "republish=yes&conditions=credit&adapt=yes&commercial=no": "CC-BY-NC-4.0",
230
+ "republish=yes&conditions=credit&adapt=shareAlike&commercial=no": "CC-BY-NC-SA-4.0",
231
+ "republish=yes&conditions=credit&adapt=no&commercial=no": "CC-BY-NC-ND-4.0"
232
+ }, b = (e) => v.filter((t) => t.id in e).map((t) => `${t.id}=${e[t.id]}`).join("&"), x = Object.freeze({
233
+ questions: v,
234
+ resolve(e) {
235
+ if (Object.keys(e).some((e) => !v.some((t) => t.id === e))) return null;
236
+ let t = y[b(e)], n = t ? _.find((e) => e.spdx === t) : void 0;
237
+ return n ? {
238
+ spdx: n.spdx,
239
+ termsHash: a(n.toTerms()),
240
+ module: n
241
+ } : null;
242
+ },
243
+ answersFor(e) {
244
+ let t = Object.entries(y).find(([, t]) => t === e);
245
+ return t ? Object.fromEntries(t[0].split("&").map((e) => e.split("="))) : null;
246
+ }
247
+ });
248
+ //#endregion
249
+ export { x as ccChooser, _ as creativeCommons };
250
+
251
+ //# sourceMappingURL=cc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cc.js","names":["ccSpdx","TERMS_PROFILE","ccUrls","RESERVED_URLS","termsHash","CC0_URLS","LEGAL_SHA256","RESERVED_SPDX","CC_DOMAINS","ALL_DOMAINS","CREATIVE_COMMONS","NAMES","legal","spdx","ccTerms","nc","code","nd","sa","permissions","prohibitions","duties","ccModule","urls","cc0","allRightsReserved","creativeCommons","questions","PATHS","pathKey","q","answers","ccChooser","key","module","m","entry","id","pair"],"sources":["../../src/catalog/cc/modules.ts","../../src/catalog/cc/chooser.ts"],"sourcesContent":["import { TERMS_PROFILE, type Duty, type Rule, type SeedLicenseTerms } from '../../terms'\nimport type { Domain, LicenseModule } from '../types'\nimport { CC0_URLS, RESERVED_SPDX, RESERVED_URLS, ccSpdx, ccUrls, type CcCode } from './urls'\n\n/** SHA-256 of legal/<spdx>.txt (SPDX license-list-data v3.29.0 text, or Seed's notice). */\nconst LEGAL_SHA256: Record<string, string> = {\n 'CC0-1.0': 'a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499',\n 'CC-BY-4.0': 'd557539df68e771cc1eedcc91d13f70fca930e508d11eedcafa4b15db49e3744',\n 'CC-BY-SA-4.0': 'cde7883b9050a1104f4ac19a1572aafd6e5d7323b68351aaf51fbf4beba54966',\n 'CC-BY-NC-4.0': 'cc97a2c4ff7723a1f25179dc7c18f676fa84191bbb36ea7d0061acaf3c102559',\n 'CC-BY-NC-SA-4.0': '600ca4e25fe11762b75a97e714707fab48bb778374e92d24c6ca068791661c11',\n 'CC-BY-ND-4.0': '4a9d465e981ae6bde7f117abbfb0e24f2cc1820e99a47efbe58593fa5c43fa29',\n 'CC-BY-NC-ND-4.0': '4f3c4a321eb0c73182eee7afa3fe0111e24dec193f2d6febcf4207f26af26839',\n [RESERVED_SPDX]: 'e11f4786261aa29fffcbf5c8d51264b2463c285000ca284d9ec6ac627607dd8a',\n}\n\nconst CC_DOMAINS: readonly Domain[] = Object.freeze(['media', 'news', 'academic', 'data'])\nconst ALL_DOMAINS: readonly Domain[] = Object.freeze(['software', 'media', 'data', 'ai-model', 'font', 'hardware', 'news', 'academic'])\nconst CREATIVE_COMMONS = Object.freeze({ name: 'Creative Commons', url: 'https://creativecommons.org' })\n\nconst NAMES: Record<CcCode, string> = {\n by: 'Attribution',\n 'by-sa': 'Attribution-ShareAlike',\n 'by-nc': 'Attribution-NonCommercial',\n 'by-nc-sa': 'Attribution-NonCommercial-ShareAlike',\n 'by-nd': 'Attribution-NoDerivatives',\n 'by-nc-nd': 'Attribution-NonCommercial-NoDerivatives',\n}\n\nfunction legal(spdx: string, canonicalUrl: string) {\n return Object.freeze({ canonicalUrl, sha256: LEGAL_SHA256[spdx]!, lang: 'en' })\n}\n\n/** Permissions in the fixed order use, reproduce, distribute, derive, distribute(adaptation), commercialize. */\nfunction ccTerms(code: CcCode): SeedLicenseTerms {\n const nc = code.includes('nc')\n const nd = code.includes('nd')\n const sa = code.includes('sa')\n const permissions: Rule[] = [{ action: 'reproduce' }, { action: 'distribute' }, { action: 'derive' }]\n if (!nd) permissions.push({ action: 'distribute', target: 'adaptation' })\n if (!nc) permissions.push({ action: 'commercialize' })\n const prohibitions: Rule[] = []\n if (nd) prohibitions.push({ action: 'distribute', target: 'adaptation' })\n if (nc) prohibitions.push({ action: 'commercialize' })\n const duties: Duty[] = [{ duty: 'attribute' }, { duty: 'includeNotice' }]\n if (sa) duties.push({ duty: 'shareAlike' })\n const spdx = ccSpdx(code)\n return {\n profile: TERMS_PROFILE,\n spdx,\n legal: { ...legal(spdx, ccUrls(code).canonicalUrl) },\n permissions,\n prohibitions,\n duties,\n grant: {\n transferable: false,\n sublicensable: false,\n exclusive: false,\n // CC 4.0 §6: terminates on breach, reinstated on cure.\n revocableFor: 'breach-only',\n warranty: 'as-is',\n duration: 'copyright-term',\n },\n }\n}\n\nfunction ccModule(code: CcCode): LicenseModule {\n const urls = ccUrls(code)\n const spdx = ccSpdx(code)\n return Object.freeze({\n id: `cc-${code}@4.0.0` as const,\n spdx,\n name: `Creative Commons ${NAMES[code]} 4.0 International`,\n shortName: `CC ${code.toUpperCase()} 4.0`,\n iri: urls.iri,\n domains: CC_DOMAINS,\n steward: CREATIVE_COMMONS,\n legal: legal(spdx, urls.canonicalUrl),\n stewardDeedUrl: urls.stewardDeedUrl,\n warnings: Object.freeze(code.includes('nc') ? (['irrevocable', 'nc-ambiguity'] as const) : (['irrevocable'] as const)),\n toTerms: () => ccTerms(code),\n })\n}\n\nconst cc0: LicenseModule = Object.freeze({\n id: 'cc0@1.0.0' as const,\n spdx: 'CC0-1.0',\n name: 'Creative Commons Zero v1.0 Universal',\n shortName: 'CC0 1.0',\n iri: CC0_URLS.iri,\n domains: CC_DOMAINS,\n steward: CREATIVE_COMMONS,\n legal: legal('CC0-1.0', CC0_URLS.canonicalUrl),\n stewardDeedUrl: CC0_URLS.stewardDeedUrl,\n warnings: Object.freeze(['irrevocable'] as const),\n toTerms: (): SeedLicenseTerms => ({\n profile: TERMS_PROFILE,\n spdx: 'CC0-1.0',\n legal: { ...legal('CC0-1.0', CC0_URLS.canonicalUrl) },\n permissions: [\n { action: 'use' },\n { action: 'reproduce' },\n { action: 'distribute' },\n { action: 'derive' },\n { action: 'distribute', target: 'adaptation' },\n { action: 'commercialize' },\n ],\n prohibitions: [],\n duties: [],\n // CC0 1.0 §3: the fallback license is non transferable and non sublicensable.\n grant: { transferable: false, sublicensable: false, exclusive: false, revocableFor: 'never', warranty: 'as-is', duration: 'copyright-term' },\n }),\n})\n\nconst allRightsReserved: LicenseModule = Object.freeze({\n id: 'all-rights-reserved@1.0.0' as const,\n spdx: RESERVED_SPDX,\n name: 'All rights reserved',\n shortName: 'All rights reserved',\n iri: RESERVED_URLS.canonicalUrl,\n domains: ALL_DOMAINS,\n steward: Object.freeze({ name: 'Seed Protocol', url: 'https://seedprotocol.io' }),\n legal: legal(RESERVED_SPDX, RESERVED_URLS.canonicalUrl),\n toTerms: (): SeedLicenseTerms => ({\n profile: TERMS_PROFILE,\n spdx: RESERVED_SPDX,\n legal: { ...legal(RESERVED_SPDX, RESERVED_URLS.canonicalUrl) },\n permissions: [],\n prohibitions: [],\n duties: [],\n grant: { transferable: false, sublicensable: false, exclusive: false, revocableFor: 'never', warranty: 'as-is', duration: 'copyright-term' },\n }),\n})\n\n/** CC0, the six CC BY 4.0 licenses and reserved rights, in the order a picker shows them. */\nexport const creativeCommons: readonly LicenseModule[] = Object.freeze([\n cc0,\n ccModule('by'),\n ccModule('by-sa'),\n ccModule('by-nc'),\n ccModule('by-nc-sa'),\n ccModule('by-nd'),\n ccModule('by-nc-nd'),\n allRightsReserved,\n])\n","import { termsHash } from '../../hash'\nimport type { Chooser, ChooserQuestion } from '../chooser'\nimport { creativeCommons } from './modules'\nimport { RESERVED_SPDX } from './urls'\n\nconst questions: readonly ChooserQuestion[] = Object.freeze([\n {\n id: 'republish',\n prompt: 'May others republish it?',\n choices: [\n { id: 'yes', label: 'Yes' },\n { id: 'no', label: 'No', ends: true },\n ],\n },\n {\n id: 'conditions',\n prompt: 'With credit, or with no conditions?',\n choices: [\n { id: 'credit', label: 'With credit' },\n { id: 'none', label: 'No conditions', ends: true },\n ],\n },\n {\n id: 'adapt',\n prompt: 'May they change it?',\n choices: [\n { id: 'yes', label: 'Yes' },\n { id: 'shareAlike', label: 'Yes, if they share alike' },\n { id: 'no', label: 'No' },\n ],\n },\n {\n id: 'commercial',\n prompt: 'May they use it commercially?',\n choices: [\n { id: 'yes', label: 'Yes' },\n { id: 'no', label: 'No' },\n ],\n },\n] satisfies ChooserQuestion[])\n\n/** Each complete answer path, as `id=choice` pairs joined by `&` in question order, to its SPDX id. */\nconst PATHS: Record<string, string> = {\n 'republish=no': RESERVED_SPDX,\n 'republish=yes&conditions=none': 'CC0-1.0',\n 'republish=yes&conditions=credit&adapt=yes&commercial=yes': 'CC-BY-4.0',\n 'republish=yes&conditions=credit&adapt=shareAlike&commercial=yes': 'CC-BY-SA-4.0',\n 'republish=yes&conditions=credit&adapt=no&commercial=yes': 'CC-BY-ND-4.0',\n 'republish=yes&conditions=credit&adapt=yes&commercial=no': 'CC-BY-NC-4.0',\n 'republish=yes&conditions=credit&adapt=shareAlike&commercial=no': 'CC-BY-NC-SA-4.0',\n 'republish=yes&conditions=credit&adapt=no&commercial=no': 'CC-BY-NC-ND-4.0',\n}\n\nconst pathKey = (answers: Record<string, string>) =>\n questions\n .filter((q) => q.id in answers)\n .map((q) => `${q.id}=${answers[q.id]}`)\n .join('&')\n\n/** The four questions PermaPress's picker asks, resolving to CC0, the six CC BY 4.0 licenses or reserved rights. */\nexport const ccChooser: Chooser = Object.freeze({\n questions,\n resolve(answers: Record<string, string>) {\n if (Object.keys(answers).some((key) => !questions.some((q) => q.id === key))) return null\n const spdx = PATHS[pathKey(answers)]\n const module = spdx ? creativeCommons.find((m) => m.spdx === spdx) : undefined\n return module ? { spdx: module.spdx, termsHash: termsHash(module.toTerms()), module } : null\n },\n answersFor(spdx: string) {\n const entry = Object.entries(PATHS).find(([, id]) => id === spdx)\n return entry ? Object.fromEntries(entry[0].split('&').map((pair) => pair.split('=') as [string, string])) : null\n },\n})\n"],"mappings":";;AAKA,IAAMM,IAAuC;CAC3C,WAAW;CACX,aAAa;CACb,gBAAgB;CAChB,gBAAgB;CAChB,mBAAmB;CACnB,gBAAgB;CAChB,mBAAmB;EAClBC,IAAgB;AACnB,GAEMC,IAAgC,OAAO,OAAO;CAAC;CAAS;CAAQ;CAAY;AAAM,CAAC,GACnFC,IAAiC,OAAO,OAAO;CAAC;CAAY;CAAS;CAAQ;CAAY;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,EAAE,MAAMC,CAAO,CAAC,CAC9B,KAAK,MAAM,GAAGD,EAAE,GAAG,GAAGC,EAAQD,EAAE,KAAK,CAAC,CACtC,KAAK,GAAG,GAGAE,IAAqB,OAAO,OAAO;CAC9C;CACA,QAAQ,GAAiC;EACvC,IAAI,OAAO,KAAKD,CAAO,CAAC,CAAC,MAAM,MAAQ,CAACJ,EAAU,MAAM,MAAMG,EAAE,OAAOG,CAAG,CAAC,GAAG,OAAO;EACrF,IAAMpB,IAAOe,EAAMC,EAAQE,CAAO,IAC5BG,IAASrB,IAAOa,EAAgB,MAAM,MAAMS,EAAE,SAAStB,CAAI,IAAI,KAAA;EACrE,OAAOqB,IAAS;GAAE,MAAMA,EAAO;GAAM,WAAW9B,EAAU8B,EAAO,QAAQ,CAAC;GAAG;EAAO,IAAI;CAC1F;CACA,WAAW,GAAc;EACvB,IAAME,IAAQ,OAAO,QAAQR,CAAK,CAAC,CAAC,MAAM,GAAGS,OAAQA,MAAOxB,CAAI;EAChE,OAAOuB,IAAQ,OAAO,YAAYA,EAAM,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,MAASE,EAAK,MAAM,GAAG,CAAqB,CAAC,IAAI;CAC9G;AACF,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { LicenseModule } from './types.js';
2
+ export interface ChooserQuestion {
3
+ id: string;
4
+ prompt: string;
5
+ /** `ends`: choosing it answers the chooser; later questions aren't asked. */
6
+ choices: {
7
+ id: string;
8
+ label: string;
9
+ ends?: true;
10
+ }[];
11
+ }
12
+ /**
13
+ * Questions that name a license, as data. Ids are the interface; prompts and labels are default
14
+ * copy an app may replace.
15
+ */
16
+ export interface Chooser {
17
+ questions: readonly ChooserQuestion[];
18
+ /** Null for an incomplete answer set, an unknown question or choice, or an answer after an ending choice. */
19
+ resolve(answers: Record<string, string>): {
20
+ spdx: string;
21
+ termsHash: string;
22
+ module: LicenseModule;
23
+ } | null;
24
+ /** The answers that lead to `spdx`, or null when no path does. */
25
+ answersFor(spdx: string): Record<string, string> | null;
26
+ }
27
+ //# sourceMappingURL=chooser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chooser.d.ts","sourceRoot":"","sources":["../../src/catalog/chooser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,EAAE,CAAA;CACtD;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,SAAS,eAAe,EAAE,CAAA;IACrC,6GAA6G;IAC7G,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,GAAG,IAAI,CAAA;IAC3G,kEAAkE;IAClE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;CACxD"}
@@ -0,0 +1,7 @@
1
+ import type { LicenseCatalog, LicenseModule } from './types.js';
2
+ /**
3
+ * An index over the modules given. Throws on a duplicate id or SPDX id, and on a module whose terms
4
+ * fail `validateTerms`, naming the module.
5
+ */
6
+ export declare function createLicenseCatalog(modules: readonly LicenseModule<any>[]): LicenseCatalog;
7
+ //# sourceMappingURL=createLicenseCatalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLicenseCatalog.d.ts","sourceRoot":"","sources":["../../src/catalog/createLicenseCatalog.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5D;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,cAAc,CAgC3F"}
@@ -0,0 +1,42 @@
1
+ import type { SeedLicenseTerms } from '../terms.js';
2
+ export type Domain = 'software' | 'media' | 'data' | 'ai-model' | 'font' | 'hardware' | 'news' | 'academic';
3
+ /**
4
+ * A license as frozen data. `id` is `<slug>@<version>` and never changes meaning once released: a
5
+ * change makes a new version. `toTerms` is pure and returns a new object on every call.
6
+ */
7
+ export interface LicenseModule<P = void> {
8
+ id: `${string}@${string}`;
9
+ spdx: string;
10
+ name: string;
11
+ shortName: string;
12
+ /** The license's IRI, for `dcterms:license` and `rel="license"`. Reserved rights uses its notice's URL. */
13
+ iri?: string;
14
+ domains: readonly Domain[];
15
+ steward: {
16
+ name: string;
17
+ url: string;
18
+ };
19
+ legal: {
20
+ canonicalUrl: string;
21
+ sha256: string;
22
+ lang: string;
23
+ };
24
+ toTerms(...params: [P] extends [void] ? [] : [params: P]): SeedLicenseTerms;
25
+ stewardDeedUrl?: string;
26
+ warnings?: readonly ('irrevocable' | 'nc-ambiguity' | 'flow-down-restrictions')[];
27
+ }
28
+ export interface LicenseCatalog {
29
+ /** Modules in the order given to `createLicenseCatalog`. */
30
+ list(filter?: {
31
+ domain?: Domain;
32
+ }): LicenseModule<any>[];
33
+ get(id: string): LicenseModule<any> | undefined;
34
+ /** Exact match on the SPDX id as the module spells it. */
35
+ bySpdx(spdx: string): LicenseModule<any> | undefined;
36
+ /** Modules with fixed terms only. */
37
+ byTermsHash(hash: string): {
38
+ module: LicenseModule<any>;
39
+ terms: SeedLicenseTerms;
40
+ } | undefined;
41
+ }
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/catalog/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gB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I,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;IACpD,qCAAqC;IACrC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAA;KAAE,GAAG,SAAS,CAAA;CAC/F"}
@@ -0,0 +1,10 @@
1
+ import type { RuleId } from './rules.js';
2
+ /** Deed template seed-deed/1.0.0, English. Draft copy, not yet reviewed by counsel. */
3
+ export declare const EN_RULE_TEXT: Record<RuleId, string>;
4
+ export declare const EN_SEE_LEGAL_TEXT = "Further conditions apply; see the legal text.";
5
+ export declare const enDisclaimer: (location: string, sha256: string) => string;
6
+ export declare const EN_EXCEPTIONS_NOTE = "Exceptions and limitations to copyright, such as fair use, still apply.";
7
+ /** Left out for a waiver such as CC0, which waives these rights too. */
8
+ export declare const EN_MORAL_RIGHTS_NOTE = "Moral rights, privacy and publicity rights are not covered.";
9
+ export declare const EN_NONCOMMERCIAL_NOTE = "What counts as non-commercial is defined by the legal text, not this summary.";
10
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/deed/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,uFAAuF;AACvF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgB/C,CAAA;AAED,eAAO,MAAM,iBAAiB,kDAAkD,CAAA;AAEhF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,EAAE,QAAQ,MAAM,WACiC,CAAA;AAE9F,eAAO,MAAM,kBAAkB,4EAA4E,CAAA;AAE3G,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,gEAAgE,CAAA;AAEjG,eAAO,MAAM,qBAAqB,kFAAkF,CAAA"}
@@ -0,0 +1,33 @@
1
+ import type { SeedLicenseTerms } from '../terms.js';
2
+ import { type RuleId } from './rules.js';
3
+ export type DeedLine = {
4
+ rule: RuleId | 'see-legal-text';
5
+ text: string;
6
+ };
7
+ export interface Deed {
8
+ template: 'seed-deed/1.0.0';
9
+ /** False until counsel reviews the sentence templates. */
10
+ reviewed: false;
11
+ disclaimer: string;
12
+ youCan: DeedLine[];
13
+ youMust: DeedLine[];
14
+ youCannot: DeedLine[];
15
+ whenTimeRunsOut: DeedLine[];
16
+ creatorPromises: DeedLine[];
17
+ notCovered: string[];
18
+ stewardDeedUrl?: string;
19
+ }
20
+ export type RenderDeedOptions = {
21
+ locale: 'en';
22
+ /** Where the legal text is served; default `terms.legal.canonicalUrl`. */
23
+ legalLocation?: string;
24
+ /** The steward's own deed, passed through for the UI to link. */
25
+ stewardDeedUrl?: string;
26
+ };
27
+ export declare function assertLocale(locale: string): void;
28
+ /**
29
+ * The plain-language summary of license terms, as data. Every line names the rule it came from;
30
+ * a term no rule covers becomes one "see the legal text" line in its section.
31
+ */
32
+ export declare function renderDeed(terms: SeedLicenseTerms, options: RenderDeedOptions): Deed;
33
+ //# sourceMappingURL=renderDeed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDeed.d.ts","sourceRoot":"","sources":["../../src/deed/renderDeed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAA6C,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhF,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAExE,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,0DAA0D;IAC1D,QAAQ,EAAE,KAAK,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,QAAQ,EAAE,CAAA;IAClB,OAAO,EAAE,QAAQ,EAAE,CAAA;IACnB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,eAAe,EAAE,QAAQ,EAAE,CAAA;IAC3B,eAAe,EAAE,QAAQ,EAAE,CAAA;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,IAAI,CAAA;IACZ,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CA2BpF"}
@@ -0,0 +1,19 @@
1
+ import type { SeedLicenseTerms } from '../terms.js';
2
+ export type DeedSection = 'youCan' | 'youMust' | 'youCannot' | 'whenTimeRunsOut' | 'creatorPromises';
3
+ export declare const RULE_IDS: readonly ["use-any-purpose", "share", "adapt", "commercial-use", "attribution", "include-notice", "share-alike", "no-conditions", "noncommercial", "no-derivatives", "permission-required", "lasts-copyright-term", "ends-on-breach", "irrevocable", "as-is"];
4
+ export type RuleId = (typeof RULE_IDS)[number];
5
+ export declare const SECTION_OF: Record<RuleId, DeedSection>;
6
+ export type DerivedRules = {
7
+ /** In vocabulary order. */
8
+ rules: RuleId[];
9
+ /** Sections holding a term no rule covers. */
10
+ uncovered: DeedSection[];
11
+ };
12
+ /**
13
+ * Which rules the terms trigger. Each rule claims the term elements it describes; a permission,
14
+ * prohibition or duty that no rule claims, or any transition or post-term block, is reported as
15
+ * uncovered so the deed points to the legal text instead of leaving it out. A rule with
16
+ * constraints is never claimed: the 1.0.0 vocabulary has no sentences for constraints.
17
+ */
18
+ export declare function deriveRules(terms: SeedLicenseTerms): DerivedRules;
19
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/deed/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEtD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAEpG,eAAO,MAAM,QAAQ,+PAgBX,CAAA;AACV,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9C,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAgBlD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,8CAA8C;IAC9C,SAAS,EAAE,WAAW,EAAE,CAAA;CACzB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CA8EjE"}
@@ -0,0 +1,9 @@
1
+ import type { SeedLicenseTerms } from '../terms.js';
2
+ /**
3
+ * One sentence that says what others may do, built from the same rules as the deed. Terms with a
4
+ * condition the rules don't cover end with "Other conditions apply." rather than leaving it out.
5
+ */
6
+ export declare function summarySentence(terms: SeedLicenseTerms, options: {
7
+ locale: 'en';
8
+ }): string;
9
+ //# sourceMappingURL=summarySentence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarySentence.d.ts","sourceRoot":"","sources":["../../src/deed/summarySentence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,MAAM,CAkB1F"}
@@ -0,0 +1,22 @@
1
+ /** Terms that fail {@link validateTerms}; `errors` lists each defect with its path. */
2
+ export declare class InvalidLicenseTermsError extends Error {
3
+ readonly errors: {
4
+ path: string;
5
+ message: string;
6
+ }[];
7
+ constructor(errors: {
8
+ path: string;
9
+ message: string;
10
+ }[]);
11
+ }
12
+ /** Deeds and summary sentences exist in English only. */
13
+ export declare class UnsupportedLocaleError extends Error {
14
+ readonly locale: string;
15
+ constructor(locale: string);
16
+ }
17
+ /** A value that RFC 8785 canonical JSON, as this package restricts it, can't represent. */
18
+ export declare class CanonicalJsonError extends Error {
19
+ readonly path: string;
20
+ constructor(path: string, reason: string);
21
+ }
22
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;gBACxC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;CAKxD;AAED,yDAAyD;AACzD,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBACX,MAAM,EAAE,MAAM;CAK3B;AAED,2FAA2F;AAC3F,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBACT,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAKzC"}