@cookiemunch/sdk 0.22.0 → 0.24.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.24.0";
24
24
  export interface CookieMunchOptions {
25
25
  apiKey: string;
26
26
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
@@ -2532,6 +2532,8 @@ export interface ExecutorSuggestion {
2532
2532
  platform: string;
2533
2533
  items: string[];
2534
2534
  operations: string[];
2535
+ openapiUrl?: string;
2536
+ statusUrl?: string;
2535
2537
  };
2536
2538
  }
2537
2539
  export interface ExecutorPresets {
@@ -2843,6 +2845,40 @@ export interface CookieMunchClient {
2843
2845
  };
2844
2846
  warnings?: string[];
2845
2847
  }>;
2848
+ /**
2849
+ * What `create` would do, without creating anything (`POST /v1/orgs?dryRun=1`). `provision` is a
2850
+ * `provision()` body, planned against the org that would be created (its id reads `<new org>`).
2851
+ */
2852
+ createDryRun(name: string, opts?: {
2853
+ mintKey?: boolean;
2854
+ keyScopes?: string[];
2855
+ keyExpiresInDays?: number;
2856
+ inheritFrom?: string;
2857
+ provision?: ProvisionRequest | ProvisionRequestV2;
2858
+ }): Promise<{
2859
+ dryRun: true;
2860
+ org: {
2861
+ name: string;
2862
+ wouldCreate: boolean;
2863
+ inheritFrom?: string;
2864
+ };
2865
+ refusal?: {
2866
+ error: 'org_limit';
2867
+ orgLimit: {
2868
+ max: number | null;
2869
+ plan: string;
2870
+ used: number;
2871
+ };
2872
+ upgradeUrl?: string;
2873
+ };
2874
+ key?: {
2875
+ scopes: string[] | 'all';
2876
+ expiresInDays: number;
2877
+ };
2878
+ /** The provision dry run's answer (a ProvisionResult on 200, an error body otherwise). */
2879
+ provision?: unknown;
2880
+ provisionStatus?: number;
2881
+ }>;
2846
2882
  /** Hard-delete a SANDBOX organisation of this account (created with metadata.stack_sandbox). Anything else: 403 not_a_sandbox. */
2847
2883
  deleteSandbox(id: string): Promise<SandboxPurge>;
2848
2884
  };
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.24.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