@openpolicy/sdk 0.0.10 → 0.0.12
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/README.md +34 -30
- package/dist/index.d.ts +42 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,33 +16,35 @@ bun add @openpolicy/sdk
|
|
|
16
16
|
### Privacy policy
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
//
|
|
20
|
-
import {
|
|
19
|
+
// openpolicy.ts
|
|
20
|
+
import { defineConfig } from "@openpolicy/sdk";
|
|
21
21
|
|
|
22
|
-
export default
|
|
23
|
-
effectiveDate: "2026-01-01",
|
|
22
|
+
export default defineConfig({
|
|
24
23
|
company: {
|
|
25
24
|
name: "Acme",
|
|
26
25
|
legalName: "Acme, Inc.",
|
|
27
26
|
address: "123 Main St, San Francisco, CA 94105",
|
|
28
27
|
contact: "privacy@acme.com",
|
|
29
28
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
privacy: {
|
|
30
|
+
effectiveDate: "2026-01-01",
|
|
31
|
+
dataCollected: {
|
|
32
|
+
"Account information": ["Email address", "Display name"],
|
|
33
|
+
"Usage data": ["Pages visited", "Session duration"],
|
|
34
|
+
},
|
|
35
|
+
legalBasis: "Legitimate interests and user consent",
|
|
36
|
+
retention: {
|
|
37
|
+
"Account data": "Until account deletion",
|
|
38
|
+
"Analytics data": "13 months",
|
|
39
|
+
},
|
|
40
|
+
cookies: { essential: true, analytics: true, marketing: false },
|
|
41
|
+
thirdParties: [
|
|
42
|
+
{ name: "Vercel", purpose: "Hosting" },
|
|
43
|
+
{ name: "Plausible", purpose: "Privacy-friendly analytics" },
|
|
44
|
+
],
|
|
45
|
+
userRights: ["access", "erasure", "portability"],
|
|
46
|
+
jurisdictions: ["us", "eu"],
|
|
33
47
|
},
|
|
34
|
-
legalBasis: "Legitimate interests and user consent",
|
|
35
|
-
retention: {
|
|
36
|
-
"Account data": "Until account deletion",
|
|
37
|
-
"Analytics data": "13 months",
|
|
38
|
-
},
|
|
39
|
-
cookies: { essential: true, analytics: true, marketing: false },
|
|
40
|
-
thirdParties: [
|
|
41
|
-
{ name: "Vercel", purpose: "Hosting" },
|
|
42
|
-
{ name: "Plausible", purpose: "Privacy-friendly analytics" },
|
|
43
|
-
],
|
|
44
|
-
userRights: ["access", "erasure", "portability"],
|
|
45
|
-
jurisdictions: ["us", "eu"],
|
|
46
48
|
});
|
|
47
49
|
```
|
|
48
50
|
|
|
@@ -50,24 +52,26 @@ export default definePrivacyPolicy({
|
|
|
50
52
|
|
|
51
53
|
```ts
|
|
52
54
|
// terms.config.ts
|
|
53
|
-
import {
|
|
55
|
+
import { defineConfig } from "@openpolicy/sdk";
|
|
54
56
|
|
|
55
|
-
export default
|
|
56
|
-
effectiveDate: "2026-01-01",
|
|
57
|
+
export default defineConfig({
|
|
57
58
|
company: {
|
|
58
59
|
name: "Acme",
|
|
59
60
|
legalName: "Acme, Inc.",
|
|
60
61
|
address: "123 Main St, San Francisco, CA 94105",
|
|
61
62
|
contact: "legal@acme.com",
|
|
62
63
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
terms: {
|
|
65
|
+
effectiveDate: "2026-01-01",
|
|
66
|
+
acceptance: { methods: ["using the service", "creating an account"] },
|
|
67
|
+
eligibility: { minimumAge: 13 },
|
|
68
|
+
disclaimers: { serviceProvidedAsIs: true, noWarranties: true },
|
|
69
|
+
limitationOfLiability: { excludesIndirectDamages: true },
|
|
70
|
+
governingLaw: { jurisdiction: "Delaware, USA" },
|
|
71
|
+
changesPolicy: {
|
|
72
|
+
noticeMethod: "email or prominent notice on the website",
|
|
73
|
+
noticePeriodDays: 30,
|
|
74
|
+
},
|
|
71
75
|
},
|
|
72
76
|
});
|
|
73
77
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
//#region ../core/dist/index.d.ts
|
|
2
2
|
type Jurisdiction = "us" | "eu" | "ca" | "au" | "nz" | "other";
|
|
3
|
+
type CompanyConfig = {
|
|
4
|
+
name: string;
|
|
5
|
+
legalName: string;
|
|
6
|
+
address: string;
|
|
7
|
+
contact: string;
|
|
8
|
+
};
|
|
3
9
|
type PrivacyPolicyConfig = {
|
|
4
10
|
effectiveDate: string;
|
|
5
|
-
company:
|
|
6
|
-
name: string;
|
|
7
|
-
legalName: string;
|
|
8
|
-
address: string;
|
|
9
|
-
contact: string;
|
|
10
|
-
};
|
|
11
|
+
company: CompanyConfig;
|
|
11
12
|
dataCollected: Record<string, string[]>;
|
|
12
13
|
legalBasis: string;
|
|
13
14
|
retention: Record<string, string>;
|
|
@@ -22,16 +23,15 @@ type PrivacyPolicyConfig = {
|
|
|
22
23
|
}[];
|
|
23
24
|
userRights: string[];
|
|
24
25
|
jurisdictions: Jurisdiction[];
|
|
26
|
+
children?: {
|
|
27
|
+
underAge: number;
|
|
28
|
+
noticeUrl?: string;
|
|
29
|
+
};
|
|
25
30
|
};
|
|
26
31
|
type DisputeResolutionMethod = "arbitration" | "litigation" | "mediation";
|
|
27
32
|
type TermsOfServiceConfig = {
|
|
28
33
|
effectiveDate: string;
|
|
29
|
-
company:
|
|
30
|
-
name: string;
|
|
31
|
-
legalName: string;
|
|
32
|
-
address: string;
|
|
33
|
-
contact: string;
|
|
34
|
-
};
|
|
34
|
+
company: CompanyConfig;
|
|
35
35
|
acceptance: {
|
|
36
36
|
methods: string[];
|
|
37
37
|
};
|
|
@@ -99,10 +99,37 @@ type TermsOfServiceConfig = {
|
|
|
99
99
|
};
|
|
100
100
|
privacyPolicyUrl?: string;
|
|
101
101
|
};
|
|
102
|
+
type CookiePolicyConfig = {
|
|
103
|
+
effectiveDate: string;
|
|
104
|
+
company: CompanyConfig;
|
|
105
|
+
cookies: {
|
|
106
|
+
essential: boolean;
|
|
107
|
+
analytics: boolean;
|
|
108
|
+
functional: boolean;
|
|
109
|
+
marketing: boolean;
|
|
110
|
+
};
|
|
111
|
+
thirdParties?: {
|
|
112
|
+
name: string;
|
|
113
|
+
purpose: string;
|
|
114
|
+
policyUrl?: string;
|
|
115
|
+
}[];
|
|
116
|
+
trackingTechnologies?: string[];
|
|
117
|
+
consentMechanism?: {
|
|
118
|
+
hasBanner: boolean;
|
|
119
|
+
hasPreferencePanel: boolean;
|
|
120
|
+
canWithdraw: boolean;
|
|
121
|
+
};
|
|
122
|
+
jurisdictions: Jurisdiction[];
|
|
123
|
+
};
|
|
124
|
+
type OpenPolicyConfig = {
|
|
125
|
+
company: CompanyConfig;
|
|
126
|
+
privacy?: Omit<PrivacyPolicyConfig, "company">;
|
|
127
|
+
terms?: Omit<TermsOfServiceConfig, "company">;
|
|
128
|
+
cookie?: Omit<CookiePolicyConfig, "company">;
|
|
129
|
+
};
|
|
102
130
|
//#endregion
|
|
103
131
|
//#region src/index.d.ts
|
|
104
|
-
declare function
|
|
105
|
-
declare function defineTermsOfService(config: TermsOfServiceConfig): TermsOfServiceConfig;
|
|
132
|
+
declare function defineConfig(config: OpenPolicyConfig): OpenPolicyConfig;
|
|
106
133
|
//#endregion
|
|
107
|
-
export { type PrivacyPolicyConfig, type TermsOfServiceConfig,
|
|
134
|
+
export { type CookiePolicyConfig, type OpenPolicyConfig, type PrivacyPolicyConfig, type TermsOfServiceConfig, defineConfig };
|
|
108
135
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["OutputFormat","CompileOptions","formats","PolicySection","id","title","body","Jurisdiction","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["OutputFormat","CompileOptions","formats","PolicySection","id","title","body","Jurisdiction","CompanyConfig","name","legalName","address","contact","PrivacyPolicyConfig","Record","effectiveDate","company","dataCollected","legalBasis","retention","cookies","essential","analytics","marketing","thirdParties","purpose","userRights","jurisdictions","children","underAge","noticeUrl","DisputeResolutionMethod","TermsOfServiceConfig","acceptance","methods","eligibility","minimumAge","jurisdictionRestrictions","accounts","registrationRequired","userResponsibleForCredentials","companyCanTerminate","prohibitedUses","userContent","usersOwnContent","licenseGrantedToCompany","licenseDescription","companyCanRemoveContent","intellectualProperty","companyOwnsService","usersMayNotCopy","payments","hasPaidFeatures","refundPolicy","priceChangesNotice","availability","noUptimeGuarantee","maintenanceWindows","termination","userCanTerminate","effectOfTermination","disclaimers","serviceProvidedAsIs","noWarranties","limitationOfLiability","excludesIndirectDamages","liabilityCap","indemnification","userIndemnifiesCompany","scope","thirdPartyServices","disputeResolution","method","venue","classActionWaiver","governingLaw","jurisdiction","changesPolicy","noticeMethod","noticePeriodDays","privacyPolicyUrl","CookiePolicyConfig","functional","policyUrl","trackingTechnologies","consentMechanism","hasBanner","hasPreferencePanel","canWithdraw","PolicyInput","type","OpenPolicyConfig","Omit","privacy","terms","cookie","isOpenPolicyConfig","value","ValidationIssue","level","message","compileCookiePolicy","config","options","format","content","sections","compilePrivacyPolicy","compileTermsOfService","validatePrivacyPolicy","validateCookiePolicy","validateTermsOfService","expandOpenPolicyConfig","compilePolicy","input"],"sources":["../../core/dist/index.d.ts","../src/index.ts"],"mappings":";KAUKO,YAAAA;AAAAA,KACAC,aAAAA;EACHC,IAAAA;EACAC,SAAAA;EACAC,OAAAA;EACAC,OAAAA;AAAAA;AAAAA,KAEGC,mBAAAA;EACHE,aAAAA;EACAC,OAAAA,EAASR,aAAAA;EACTS,aAAAA,EAAeH,MAAAA;EACfI,UAAAA;EACAC,SAAAA,EAAWL,MAAAA;EACXM,OAAAA;IACEC,SAAAA;IACAC,SAAAA;IACAC,SAAAA;EAAAA;EAEFC,YAAAA;IACEf,IAAAA;IACAgB,OAAAA;EAAAA;EAEFC,UAAAA;EACAC,aAAAA,EAAepB,YAAAA;EACfqB,QAAAA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AAA;IACAC,kBAAAA;IACAC,WAAAA;EAAAA;EAEF7D,aAAAA,EAAepB,YAAAA;AAAAA;AAAAA,KASZoF,gBAAAA;EACH3E,OAAAA,EAASR,aAAAA;EACTqF,OAAAA,GAAUD,IAAAA,CAAK/E,mBAAAA;EACfiF,KAAAA,GAAQF,IAAAA,CAAK5D,oBAAAA;EACb+D,MAAAA,GAASH,IAAAA,CAAKX,kBAAAA;AAAAA;;;iBCtIA,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
//#region src/index.ts
|
|
2
|
-
function
|
|
3
|
-
return config;
|
|
4
|
-
}
|
|
5
|
-
function defineTermsOfService(config) {
|
|
2
|
+
function defineConfig(config) {
|
|
6
3
|
return config;
|
|
7
4
|
}
|
|
8
5
|
//#endregion
|
|
9
|
-
export {
|
|
6
|
+
export { defineConfig };
|
|
10
7
|
|
|
11
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { OpenPolicyConfig } from \"@openpolicy/core\";\n\nexport type {\n\tCookiePolicyConfig,\n\tOpenPolicyConfig,\n\tPrivacyPolicyConfig,\n\tTermsOfServiceConfig,\n} from \"@openpolicy/core\";\n\nexport function defineConfig(config: OpenPolicyConfig): OpenPolicyConfig {\n\treturn config;\n}\n"],"mappings":";AASA,SAAgB,aAAa,QAA4C;AACxE,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpolicy/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Public API for defining privacy policies with OpenPolicy",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "GPL-3.0-only",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/jamiedavenport/openpolicy",
|