@cookiemunch/sdk 0.22.0 → 0.23.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.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.22.0";
23
+ export declare const SDK_VERSION = "0.23.0";
24
24
  export interface CookieMunchOptions {
25
25
  apiKey: string;
26
26
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
@@ -2843,6 +2843,40 @@ export interface CookieMunchClient {
2843
2843
  };
2844
2844
  warnings?: string[];
2845
2845
  }>;
2846
+ /**
2847
+ * What `create` would do, without creating anything (`POST /v1/orgs?dryRun=1`). `provision` is a
2848
+ * `provision()` body, planned against the org that would be created (its id reads `<new org>`).
2849
+ */
2850
+ createDryRun(name: string, opts?: {
2851
+ mintKey?: boolean;
2852
+ keyScopes?: string[];
2853
+ keyExpiresInDays?: number;
2854
+ inheritFrom?: string;
2855
+ provision?: ProvisionRequest | ProvisionRequestV2;
2856
+ }): Promise<{
2857
+ dryRun: true;
2858
+ org: {
2859
+ name: string;
2860
+ wouldCreate: boolean;
2861
+ inheritFrom?: string;
2862
+ };
2863
+ refusal?: {
2864
+ error: 'org_limit';
2865
+ orgLimit: {
2866
+ max: number | null;
2867
+ plan: string;
2868
+ used: number;
2869
+ };
2870
+ upgradeUrl?: string;
2871
+ };
2872
+ key?: {
2873
+ scopes: string[] | 'all';
2874
+ expiresInDays: number;
2875
+ };
2876
+ /** The provision dry run's answer (a ProvisionResult on 200, an error body otherwise). */
2877
+ provision?: unknown;
2878
+ provisionStatus?: number;
2879
+ }>;
2846
2880
  /** Hard-delete a SANDBOX organisation of this account (created with metadata.stack_sandbox). Anything else: 403 not_a_sandbox. */
2847
2881
  deleteSandbox(id: string): Promise<SandboxPurge>;
2848
2882
  };
package/dist/index.js CHANGED
@@ -13,8 +13,9 @@ import {
13
13
  CANARY_ISSUER,
14
14
  CONFORMANCE_RULES,
15
15
  canaryIdentityFor,
16
- runExecutorConformance
17
- } from "./chunk-7Q6XFXKS.js";
16
+ runExecutorConformance,
17
+ secretPaths
18
+ } from "./chunk-VXN75KHK.js";
18
19
 
19
20
  // src/webhooks.ts
20
21
  import { createHmac, timingSafeEqual } from "crypto";
@@ -88,7 +89,7 @@ async function exchangeOperatorToken(input) {
88
89
  }
89
90
 
90
91
  // src/index.ts
91
- var SDK_VERSION = "0.22.0";
92
+ var SDK_VERSION = "0.23.0";
92
93
  var CookieMunchApiError = class extends Error {
93
94
  constructor(status, message, code, body) {
94
95
  super(message);
@@ -178,6 +179,7 @@ function createCookieMunch(opts) {
178
179
  orgs: {
179
180
  list: (o) => get(`/orgs${metaQs(o)}`),
180
181
  create: (name, opts2) => request("POST", "/orgs", { name, ...opts2 ?? {} }),
182
+ createDryRun: (name, opts2) => request("POST", "/orgs?dryRun=1", { name, ...opts2 ?? {} }),
181
183
  deleteSandbox: (id) => request("DELETE", `/orgs/${enc(id)}?hard=1`)
182
184
  },
183
185
  metadata: {
@@ -646,6 +648,7 @@ export {
646
648
  parseConsentValue,
647
649
  readConsent,
648
650
  runExecutorConformance,
651
+ secretPaths,
649
652
  verifyDecisionSignature,
650
653
  verifyToken,
651
654
  verifyWebhookSignature