@cookiemunch/sdk 0.32.0 → 0.34.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/dist/index.cjs +11 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/rights/express.cjs +86 -0
- package/dist/rights/express.cjs.map +1 -0
- package/dist/rights/express.d.ts +56 -0
- package/dist/rights/express.js +60 -0
- package/dist/rights/express.js.map +1 -0
- package/dist/rights.cjs +15 -0
- package/dist/rights.cjs.map +1 -1
- package/dist/rights.d.ts +10 -2
- package/dist/rights.js +14 -0
- package/dist/rights.js.map +1 -1
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type { ConformanceReport } from './executor-conformance.js';
|
|
|
20
20
|
* This package's version, sent in the default User-Agent. Cloudflare answers a request with
|
|
21
21
|
* no recognisable User-Agent with `403 error code: 1010`; a test pins this to package.json.
|
|
22
22
|
*/
|
|
23
|
-
export declare const SDK_VERSION = "0.
|
|
23
|
+
export declare const SDK_VERSION = "0.34.0";
|
|
24
24
|
export interface CookieMunchOptions {
|
|
25
25
|
apiKey: string;
|
|
26
26
|
/** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
|
|
@@ -107,6 +107,11 @@ export interface StandardPartnerLink {
|
|
|
107
107
|
externalId?: string;
|
|
108
108
|
label?: string;
|
|
109
109
|
}
|
|
110
|
+
/** PATCH a partner link in place (CM-17): one or both. Scopes and events cannot change in place. */
|
|
111
|
+
export interface PartnerLinkUpdate {
|
|
112
|
+
externalId?: string;
|
|
113
|
+
label?: string;
|
|
114
|
+
}
|
|
110
115
|
export interface StandardPartnerLinkCreate extends ResourceTagsInput {
|
|
111
116
|
partner: string;
|
|
112
117
|
/** `site:<cbid>` or `org:<org id>`. */
|
|
@@ -2932,6 +2937,14 @@ export interface CookieMunchClient {
|
|
|
2932
2937
|
list(opts?: MetadataFilter): Promise<StandardPartnerLink[]>;
|
|
2933
2938
|
create(input: StandardPartnerLinkCreate): Promise<StandardPartnerLink>;
|
|
2934
2939
|
revoke(id: string): Promise<StandardPartnerLink>;
|
|
2940
|
+
/** Fix a link's externalId or label in place, keeping the grant. `warnings` names executor keys to re-mint. */
|
|
2941
|
+
update(id: string, input: PartnerLinkUpdate, opts?: {
|
|
2942
|
+
dryRun?: boolean;
|
|
2943
|
+
}): Promise<StandardPartnerLink & {
|
|
2944
|
+
change: 'updated' | 'unchanged';
|
|
2945
|
+
dryRun?: true;
|
|
2946
|
+
warnings?: string[];
|
|
2947
|
+
}>;
|
|
2935
2948
|
};
|
|
2936
2949
|
/** What `env` writes for a product provisioned with this stack ref: names, values, secret references. */
|
|
2937
2950
|
provisionEnv(ref: string): Promise<ProvisionEnv>;
|
|
@@ -2966,6 +2979,15 @@ export interface CookieMunchClient {
|
|
|
2966
2979
|
unlinkPartner(cbid: string, linkId: string): Promise<{
|
|
2967
2980
|
link: PartnerLink;
|
|
2968
2981
|
}>;
|
|
2982
|
+
/** Fix a site link's externalId or label in place, keeping the grant. `warnings` names executor keys to re-mint. */
|
|
2983
|
+
updatePartner(cbid: string, linkId: string, input: PartnerLinkUpdate, opts?: {
|
|
2984
|
+
dryRun?: boolean;
|
|
2985
|
+
}): Promise<{
|
|
2986
|
+
change: 'updated' | 'unchanged';
|
|
2987
|
+
link: PartnerLink;
|
|
2988
|
+
dryRun?: true;
|
|
2989
|
+
warnings?: string[];
|
|
2990
|
+
}>;
|
|
2969
2991
|
getConfig(cbid: string): Promise<SiteConfig>;
|
|
2970
2992
|
/**
|
|
2971
2993
|
* Replaces the whole config — a top-level field you omit reverts to its default. With
|
|
@@ -4090,3 +4112,12 @@ export interface CookieMunchClient {
|
|
|
4090
4112
|
};
|
|
4091
4113
|
}
|
|
4092
4114
|
export declare function createCookieMunch(opts: CookieMunchOptions): CookieMunchClient;
|
|
4115
|
+
/**
|
|
4116
|
+
* The account-link URL for a person your server has verified is signed in (CM-14): wraps
|
|
4117
|
+
* `rightsLinks.create` (POST /v1/sites/{cbid}/rights-links) and answers just the `url`. Pass a client,
|
|
4118
|
+
* or the options to build one with a `dsar:rights-links` (or `dsar:write`) key. Call it from a route
|
|
4119
|
+
* that reads the subject from your own session, never from the browser's input.
|
|
4120
|
+
*/
|
|
4121
|
+
export declare function rightsLink(clientOrOptions: Pick<CookieMunchClient, 'rightsLinks'> | CookieMunchOptions, input: RightsLinkInput & {
|
|
4122
|
+
cbid: string;
|
|
4123
|
+
}): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ async function exchangeOperatorToken(input) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// src/index.ts
|
|
92
|
-
var SDK_VERSION = "0.
|
|
92
|
+
var SDK_VERSION = "0.34.0";
|
|
93
93
|
var CookieMunchApiError = class extends Error {
|
|
94
94
|
constructor(status, message, code, body) {
|
|
95
95
|
super(message);
|
|
@@ -189,7 +189,8 @@ function createCookieMunch(opts) {
|
|
|
189
189
|
partnerLinks: {
|
|
190
190
|
list: (o) => get(`/partner_links${metaQs(o)}`),
|
|
191
191
|
create: (input) => request("POST", "/partner_links", input),
|
|
192
|
-
revoke: (id) => request("DELETE", `/partner_links/${enc(id)}`)
|
|
192
|
+
revoke: (id) => request("DELETE", `/partner_links/${enc(id)}`),
|
|
193
|
+
update: (id, input, o) => request("PATCH", `/partner_links/${enc(id)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input)
|
|
193
194
|
},
|
|
194
195
|
provisionEnv: (ref) => get(`/provision/env${qs({ ref })}`),
|
|
195
196
|
sites: {
|
|
@@ -204,6 +205,7 @@ function createCookieMunch(opts) {
|
|
|
204
205
|
listPartners: (cbid) => get(`/sites/${enc(cbid)}/partners`),
|
|
205
206
|
linkPartner: (cbid, input, o) => request("POST", `/sites/${enc(cbid)}/partners${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
206
207
|
unlinkPartner: (cbid, linkId) => request("DELETE", `/sites/${enc(cbid)}/partners/${enc(linkId)}`),
|
|
208
|
+
updatePartner: (cbid, linkId, input, o) => request("PATCH", `/sites/${enc(cbid)}/partners/${enc(linkId)}${qs({ dryRun: o?.dryRun ? "1" : void 0 })}`, input),
|
|
207
209
|
getConfig: (cbid) => get(`/sites/${enc(cbid)}/config`),
|
|
208
210
|
putConfig: (cbid, config, opts2) => request("PUT", `/sites/${enc(cbid)}/config${qs({ keep: opts2?.keep })}`, config),
|
|
209
211
|
patchConfig: (cbid, config) => request("PATCH", `/sites/${enc(cbid)}/config`, config),
|
|
@@ -631,6 +633,11 @@ function createCookieMunch(opts) {
|
|
|
631
633
|
}
|
|
632
634
|
};
|
|
633
635
|
}
|
|
636
|
+
async function rightsLink(clientOrOptions, input) {
|
|
637
|
+
const client = "rightsLinks" in clientOrOptions ? clientOrOptions : createCookieMunch(clientOrOptions);
|
|
638
|
+
const { cbid, ...body } = input;
|
|
639
|
+
return (await client.rightsLinks.create(cbid, body)).url;
|
|
640
|
+
}
|
|
634
641
|
export {
|
|
635
642
|
CANARY_ISSUER,
|
|
636
643
|
CONFORMANCE_RULES,
|
|
@@ -648,6 +655,7 @@ export {
|
|
|
648
655
|
mintConsentSyncToken,
|
|
649
656
|
parseConsentValue,
|
|
650
657
|
readConsent,
|
|
658
|
+
rightsLink,
|
|
651
659
|
runExecutorConformance,
|
|
652
660
|
secretPaths,
|
|
653
661
|
verifyDecisionSignature,
|