@veroxm/sdk 0.3.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+
5
+ - Stable: from 1.0, breaking changes come only in a major version, after a deprecation period. What that covers
6
+ and what it doesn't: the [stability policy](https://docs.veroxm.com/sdks/stability). The public API is listed in `api-report.md`.
7
+ - `auth.signInWithCredentials()` resolves to the signed-in person (`AuthUser | null`), like `signInWithEmail()`. It
8
+ resolved to nothing before; code that ignores the result is unaffected.
9
+ - `VeroXMApp.request()` is marked `@internal`: use the resources (`content`, `media`, `functions`, `tasks`,
10
+ `processes`), or `ApiPaths` with a typed fetch helper, for calls the SDK doesn't wrap.
11
+
3
12
  ## 0.3.0
4
13
 
5
14
  - `app.functions` (call functions with an HTTP trigger), `app.tasks` (process tasks for end users and server keys)
package/README.md CHANGED
@@ -343,6 +343,12 @@ try {
343
343
  }
344
344
  ```
345
345
 
346
+ ## Stability
347
+
348
+ Follows semantic versioning. From 1.0, breaking changes come only in a major version, after at least one minor release with the
349
+ feature marked deprecated. What the promise covers (and what it doesn't, such as anything marked `@internal` or
350
+ `@experimental`) is in the [stability policy](https://docs.veroxm.com/sdks/stability).
351
+
346
352
  ## Documentation and support
347
353
 
348
354
  - Guide: https://docs.veroxm.com/sdks#veroxm-sdk
package/dist/auth.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare class VeroXMAuth {
56
56
  /** Static-key mode: no login round-trip, no expiry, no refresh token. */
57
57
  signInWithApiKey(apiKey: string): void;
58
58
  /** Username/password mode -- exchanges credentials for an access+refresh token pair and persists it via the configured TokenStorage. */
59
- signInWithCredentials(username: string, password: string): Promise<void>;
59
+ signInWithCredentials(username: string, password: string): Promise<AuthUser | null>;
60
60
  /** Signs in a built-in account with its email and password. Throws VeroXMApiError with code `email_not_verified` until the email is confirmed. */
61
61
  signInWithEmail(email: string, password: string): Promise<AuthUser | null>;
62
62
  /** Signs out here: the refresh token is revoked on the server too (best effort), and the stored session cleared. */
package/dist/auth.js CHANGED
@@ -63,6 +63,7 @@ export class VeroXMAuth {
63
63
  }));
64
64
  this.apiKey = null;
65
65
  await this.persistSession(data);
66
+ return this.currentUser();
66
67
  }
67
68
  /** Signs in a built-in account with its email and password. Throws VeroXMApiError with code `email_not_verified` until the email is confirmed. */
68
69
  async signInWithEmail(email, password) {
package/dist/client.d.ts CHANGED
@@ -42,6 +42,9 @@ export declare class VeroXMApp {
42
42
  * 401 (clock skew, or a token revoked server-side since the last
43
43
  * proactive refresh), forces one refresh and retries exactly once
44
44
  * before giving up.
45
+ *
46
+ * @internal Not part of the stable API (docs/SDK-STABILITY.md): its options can change in a minor release. Use the
47
+ * resources (`content`, `media`, `functions`, `tasks`, `processes`), or `ApiPaths` with a typed fetch helper.
45
48
  */
46
49
  request(opts: RawRequestOptions): Promise<unknown>;
47
50
  }
package/dist/client.js CHANGED
@@ -45,6 +45,9 @@ export class VeroXMApp {
45
45
  * 401 (clock skew, or a token revoked server-side since the last
46
46
  * proactive refresh), forces one refresh and retries exactly once
47
47
  * before giving up.
48
+ *
49
+ * @internal Not part of the stable API (docs/SDK-STABILITY.md): its options can change in a minor release. Use the
50
+ * resources (`content`, `media`, `functions`, `tasks`, `processes`), or `ApiPaths` with a typed fetch helper.
48
51
  */
49
52
  async request(opts) {
50
53
  const token = await this.auth.getAccessToken();
@@ -492,6 +492,60 @@ export interface paths {
492
492
  patch?: never;
493
493
  trace?: never;
494
494
  };
495
+ "/projects/{uuid}/setup": {
496
+ parameters: {
497
+ query?: never;
498
+ header?: never;
499
+ path?: never;
500
+ cookie?: never;
501
+ };
502
+ /** The project's setup file (setup keys) */
503
+ get: operations["exportSetup"];
504
+ put?: never;
505
+ post?: never;
506
+ delete?: never;
507
+ options?: never;
508
+ head?: never;
509
+ patch?: never;
510
+ trace?: never;
511
+ };
512
+ "/projects/{uuid}/setup/preview": {
513
+ parameters: {
514
+ query?: never;
515
+ header?: never;
516
+ path?: never;
517
+ cookie?: never;
518
+ };
519
+ get?: never;
520
+ put?: never;
521
+ /** Compare a setup file with the project, changing nothing (setup keys) */
522
+ post: operations["previewSetup"];
523
+ delete?: never;
524
+ options?: never;
525
+ head?: never;
526
+ patch?: never;
527
+ trace?: never;
528
+ };
529
+ "/projects/{uuid}/setup/apply": {
530
+ parameters: {
531
+ query?: never;
532
+ header?: never;
533
+ path?: never;
534
+ cookie?: never;
535
+ };
536
+ get?: never;
537
+ put?: never;
538
+ /**
539
+ * Apply a previewed setup file, all or nothing (setup keys)
540
+ * @description Makes the changes a preview listed with `applies: true`. 409 (`code: "stale_preview"`) when the project changed after the preview: preview again.
541
+ */
542
+ post: operations["applySetup"];
543
+ delete?: never;
544
+ options?: never;
545
+ head?: never;
546
+ patch?: never;
547
+ trace?: never;
548
+ };
495
549
  "/projects/{uuid}/events": {
496
550
  parameters: {
497
551
  query?: never;
@@ -978,6 +1032,50 @@ export interface components {
978
1032
  strategy: "personal" | "popular";
979
1033
  items: components["schemas"]["Entry"][];
980
1034
  };
1035
+ /** @description A project setup file, as GET /setup returns it: `format` ("veroxm.project-config"), `version`, the locales, collections and fields, webhooks, functions (with their code), sign-in settings and providers, segments, experiences, journeys, processes, slots and the approval workflow. An area a file leaves out is left alone. See docs.veroxm.com/managing-projects/environments#setup-file. */
1036
+ SetupFile: {
1037
+ [key: string]: unknown;
1038
+ };
1039
+ SetupChange: {
1040
+ /**
1041
+ * @description remove: in the project, not the file. conflict: differs but can't be applied (detail says why).
1042
+ * @enum {string}
1043
+ */
1044
+ kind: "add" | "change" | "remove" | "conflict";
1045
+ /** @description What it is: "collection", "field", "function", "experience", "journey", ... (an open set). */
1046
+ area: string;
1047
+ /** @description Which one: a slug, a name or a key. */
1048
+ key: string;
1049
+ /** @description What differs, or why it can't be applied. */
1050
+ detail: string;
1051
+ /** @description Whether apply makes this change. */
1052
+ applies: boolean;
1053
+ };
1054
+ SetupPreview: {
1055
+ /** @description The file's problems ("path: problem"). When there are any, nothing else is compared. */
1056
+ errors: string[];
1057
+ changes: components["schemas"]["SetupChange"][];
1058
+ /** @description The project's setup as compared. Send it with apply, which refuses if the project changed since. */
1059
+ baseHash: string;
1060
+ };
1061
+ SetupPreviewRequest: {
1062
+ config: components["schemas"]["SetupFile"];
1063
+ /** @description Also list (and, for webhooks, functions and sign-in providers, remove) what the project has and the file doesn't. */
1064
+ prune?: boolean;
1065
+ };
1066
+ SetupApplyRequest: {
1067
+ config: components["schemas"]["SetupFile"];
1068
+ /** @description From the preview. */
1069
+ baseHash: string;
1070
+ /** @description As in the preview. */
1071
+ prune?: boolean;
1072
+ };
1073
+ SetupApplied: {
1074
+ /** @description How many changes were made. */
1075
+ applied: number;
1076
+ /** @description The changes made. */
1077
+ changes: components["schemas"]["SetupChange"][];
1078
+ };
981
1079
  };
982
1080
  responses: {
983
1081
  /** @description The request is not valid */
@@ -2234,6 +2332,96 @@ export interface operations {
2234
2332
  429: components["responses"]["E429"];
2235
2333
  };
2236
2334
  };
2335
+ exportSetup: {
2336
+ parameters: {
2337
+ query?: never;
2338
+ header?: never;
2339
+ path: {
2340
+ /** @description The project's UUID. */
2341
+ uuid: string;
2342
+ };
2343
+ cookie?: never;
2344
+ };
2345
+ requestBody?: never;
2346
+ responses: {
2347
+ /** @description OK */
2348
+ 200: {
2349
+ headers: {
2350
+ [name: string]: unknown;
2351
+ };
2352
+ content: {
2353
+ "application/json": components["schemas"]["SetupFile"];
2354
+ };
2355
+ };
2356
+ 401: components["responses"]["E401"];
2357
+ 403: components["responses"]["E403"];
2358
+ 429: components["responses"]["E429"];
2359
+ };
2360
+ };
2361
+ previewSetup: {
2362
+ parameters: {
2363
+ query?: never;
2364
+ header?: never;
2365
+ path: {
2366
+ /** @description The project's UUID. */
2367
+ uuid: string;
2368
+ };
2369
+ cookie?: never;
2370
+ };
2371
+ requestBody: {
2372
+ content: {
2373
+ "application/json": components["schemas"]["SetupPreviewRequest"];
2374
+ };
2375
+ };
2376
+ responses: {
2377
+ /** @description OK */
2378
+ 200: {
2379
+ headers: {
2380
+ [name: string]: unknown;
2381
+ };
2382
+ content: {
2383
+ "application/json": components["schemas"]["SetupPreview"];
2384
+ };
2385
+ };
2386
+ 401: components["responses"]["E401"];
2387
+ 403: components["responses"]["E403"];
2388
+ 413: components["responses"]["E413"];
2389
+ 429: components["responses"]["E429"];
2390
+ };
2391
+ };
2392
+ applySetup: {
2393
+ parameters: {
2394
+ query?: never;
2395
+ header?: never;
2396
+ path: {
2397
+ /** @description The project's UUID. */
2398
+ uuid: string;
2399
+ };
2400
+ cookie?: never;
2401
+ };
2402
+ requestBody: {
2403
+ content: {
2404
+ "application/json": components["schemas"]["SetupApplyRequest"];
2405
+ };
2406
+ };
2407
+ responses: {
2408
+ /** @description OK */
2409
+ 200: {
2410
+ headers: {
2411
+ [name: string]: unknown;
2412
+ };
2413
+ content: {
2414
+ "application/json": components["schemas"]["SetupApplied"];
2415
+ };
2416
+ };
2417
+ 400: components["responses"]["E400"];
2418
+ 401: components["responses"]["E401"];
2419
+ 403: components["responses"]["E403"];
2420
+ 409: components["responses"]["E409"];
2421
+ 413: components["responses"]["E413"];
2422
+ 429: components["responses"]["E429"];
2423
+ };
2424
+ };
2237
2425
  sendEvents: {
2238
2426
  parameters: {
2239
2427
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veroxm/sdk",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "VeroXM client for JavaScript and TypeScript: content, media, experiences, events and the visitor tracker.",
5
5
  "keywords": [
6
6
  "veroxm",
@@ -43,7 +43,8 @@
43
43
  "scripts": {
44
44
  "build": "tsc -p tsconfig.json",
45
45
  "test": "vitest run",
46
- "gen:types": "node scripts/gen-types.mjs"
46
+ "gen:types": "node scripts/gen-types.mjs",
47
+ "api:report": "node ../../scripts/api-report.mjs . --write"
47
48
  },
48
49
  "devDependencies": {
49
50
  "openapi-typescript": "^7.13.0",