@lessly/sdk-app 32.1.0 → 32.1.2

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.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/dist/analytics/index.d.cts +1 -1
  3. package/dist/analytics/index.d.ts +1 -1
  4. package/dist/brain/index.cjs +5 -0
  5. package/dist/brain/index.cjs.map +1 -1
  6. package/dist/brain/index.d.cts +6 -2
  7. package/dist/brain/index.d.ts +6 -2
  8. package/dist/brain/index.js +5 -1
  9. package/dist/brain/index.js.map +1 -1
  10. package/dist/{client.gen-BaBUJ3xx.d.cts → client.gen-p_iZK5OO.d.cts} +255 -1274
  11. package/dist/{client.gen-BaBUJ3xx.d.ts → client.gen-p_iZK5OO.d.ts} +255 -1274
  12. package/dist/consent/index.d.cts +1 -1
  13. package/dist/consent/index.d.ts +1 -1
  14. package/dist/deployment/index.d.cts +1 -1
  15. package/dist/deployment/index.d.ts +1 -1
  16. package/dist/index.cjs +70 -411
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +6 -1
  19. package/dist/index.d.ts +6 -1
  20. package/dist/index.js +70 -411
  21. package/dist/index.js.map +1 -1
  22. package/dist/mail/index.d.cts +2 -2
  23. package/dist/mail/index.d.ts +2 -2
  24. package/dist/organization/index.cjs +18 -33
  25. package/dist/organization/index.cjs.map +1 -1
  26. package/dist/organization/index.d.cts +15 -27
  27. package/dist/organization/index.d.ts +15 -27
  28. package/dist/organization/index.js +15 -27
  29. package/dist/organization/index.js.map +1 -1
  30. package/dist/realtime/index.d.cts +1 -1
  31. package/dist/realtime/index.d.ts +1 -1
  32. package/dist/support/index.d.cts +1 -1
  33. package/dist/support/index.d.ts +1 -1
  34. package/dist/tracking/index.d.cts +1 -1
  35. package/dist/tracking/index.d.ts +1 -1
  36. package/dist/users/index.d.cts +1 -1
  37. package/dist/users/index.d.ts +1 -1
  38. package/dist/waitlist/index.d.cts +1 -1
  39. package/dist/waitlist/index.d.ts +1 -1
  40. package/docs/recipes/local-dev.md +4 -0
  41. package/docs/recipes/sdk-usage.md +20 -0
  42. package/package.json +2 -12
  43. package/src/gen/bindings.gen.ts +51 -410
  44. package/src/gen/brain/index.ts +1 -1
  45. package/src/gen/brain/queryOptions.gen.ts +7 -0
  46. package/src/gen/client.gen.ts +17 -126
  47. package/src/gen/manifest.gen.ts +1 -1
  48. package/src/gen/organization/index.ts +1 -1
  49. package/src/gen/organization/queryOptions.gen.ts +21 -41
  50. package/src/gen/types.gen.ts +246 -1273
  51. package/dist/observe/index.cjs +0 -71
  52. package/dist/observe/index.cjs.map +0 -1
  53. package/dist/observe/index.d.cts +0 -56
  54. package/dist/observe/index.d.ts +0 -56
  55. package/dist/observe/index.js +0 -57
  56. package/dist/observe/index.js.map +0 -1
  57. package/dist/playground/index.cjs +0 -66
  58. package/dist/playground/index.cjs.map +0 -1
  59. package/dist/playground/index.d.cts +0 -52
  60. package/dist/playground/index.d.ts +0 -52
  61. package/dist/playground/index.js +0 -53
  62. package/dist/playground/index.js.map +0 -1
  63. package/src/gen/observe/index.ts +0 -3
  64. package/src/gen/observe/queryOptions.gen.ts +0 -89
  65. package/src/gen/playground/index.ts +0 -3
  66. package/src/gen/playground/queryOptions.gen.ts +0 -86
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as GeneratedClient } from './client.gen-BaBUJ3xx.cjs';
1
+ import { G as GeneratedClient } from './client.gen-p_iZK5OO.cjs';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
4
  type ParamIn = 'path' | 'query' | 'body';
@@ -16,6 +16,11 @@ type ActionBindings = Record<string, Binding>;
16
16
  type ResourceBindings = Record<string, ActionBindings>;
17
17
  type BindingsMap = Record<string, ResourceBindings>;
18
18
  interface LesslyAppOptions {
19
+ /**
20
+ * Absolute origin ("https://api.lessly.dev") or a path relative to the page
21
+ * ("/api", ""), which is resolved against globalThis.location and therefore
22
+ * only works in a browser.
23
+ */
19
24
  baseUrl: string;
20
25
  productId: string;
21
26
  getCsrfToken?: () => string | null | undefined;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as GeneratedClient } from './client.gen-BaBUJ3xx.js';
1
+ import { G as GeneratedClient } from './client.gen-p_iZK5OO.js';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
4
  type ParamIn = 'path' | 'query' | 'body';
@@ -16,6 +16,11 @@ type ActionBindings = Record<string, Binding>;
16
16
  type ResourceBindings = Record<string, ActionBindings>;
17
17
  type BindingsMap = Record<string, ResourceBindings>;
18
18
  interface LesslyAppOptions {
19
+ /**
20
+ * Absolute origin ("https://api.lessly.dev") or a path relative to the page
21
+ * ("/api", ""), which is resolved against globalThis.location and therefore
22
+ * only works in a browser.
23
+ */
19
24
  baseUrl: string;
20
25
  productId: string;
21
26
  getCsrfToken?: () => string | null | undefined;
package/dist/index.js CHANGED
@@ -62,8 +62,26 @@ function resolveRequest(binding, input = {}) {
62
62
  }
63
63
  return { path, query, body: Object.keys(body).length > 0 ? body : void 0 };
64
64
  }
65
+ function documentBase(baseUrl) {
66
+ const href = globalThis.location?.href;
67
+ if (typeof href !== "string" || href === "") {
68
+ throw new Error(
69
+ `@lessly/sdk-app: relative baseUrl "${baseUrl}" cannot be resolved outside a browser (globalThis.location is unavailable). Pass an absolute baseUrl, e.g. "https://api.lessly.dev".`
70
+ );
71
+ }
72
+ return href;
73
+ }
74
+ function isAbsolute(baseUrl) {
75
+ try {
76
+ new URL(baseUrl);
77
+ return true;
78
+ } catch {
79
+ return false;
80
+ }
81
+ }
65
82
  function buildUrl(baseUrl, path, query) {
66
- const url = new URL(baseUrl.replace(/\/$/, "") + path);
83
+ const base = baseUrl.replace(/\/$/, "") + path;
84
+ const url = isAbsolute(baseUrl) ? new URL(base) : new URL(base, documentBase(baseUrl));
67
85
  for (const [k, v] of Object.entries(query)) {
68
86
  if (v === void 0 || v === null) continue;
69
87
  if (Array.isArray(v)) v.forEach((item) => url.searchParams.append(k, String(item)));
@@ -803,6 +821,19 @@ var bindings = {
803
821
  "path": "/brain/restores/:restoreId",
804
822
  "readOnly": true
805
823
  }
824
+ },
825
+ "usage": {
826
+ "report": {
827
+ "method": "GET",
828
+ "params": [
829
+ {
830
+ "in": "query",
831
+ "name": "days"
832
+ }
833
+ ],
834
+ "path": "/brain/usage/report",
835
+ "readOnly": true
836
+ }
806
837
  }
807
838
  },
808
839
  "consent": {
@@ -3590,227 +3621,6 @@ var bindings = {
3590
3621
  }
3591
3622
  }
3592
3623
  },
3593
- "observe": {
3594
- "artifacts": {
3595
- "delete": {
3596
- "method": "DELETE",
3597
- "params": [
3598
- {
3599
- "in": "path",
3600
- "name": "id"
3601
- }
3602
- ],
3603
- "path": "/observe/artifacts/:id",
3604
- "readOnly": false
3605
- },
3606
- "list": {
3607
- "method": "GET",
3608
- "params": [
3609
- {
3610
- "in": "query",
3611
- "name": "debugId"
3612
- },
3613
- {
3614
- "in": "query",
3615
- "name": "limit"
3616
- }
3617
- ],
3618
- "path": "/observe/artifacts",
3619
- "readOnly": true
3620
- },
3621
- "resolve": {
3622
- "method": "GET",
3623
- "params": [
3624
- {
3625
- "in": "path",
3626
- "name": "issueId"
3627
- }
3628
- ],
3629
- "path": "/observe/artifacts/:issueId/resolve",
3630
- "readOnly": true
3631
- }
3632
- },
3633
- "issues": {
3634
- "archive": {
3635
- "method": "POST",
3636
- "params": [
3637
- {
3638
- "in": "path",
3639
- "name": "id"
3640
- }
3641
- ],
3642
- "path": "/observe/issues/:id/archive",
3643
- "readOnly": false
3644
- },
3645
- "assign": {
3646
- "method": "POST",
3647
- "params": [
3648
- {
3649
- "in": "path",
3650
- "name": "id"
3651
- },
3652
- {
3653
- "in": "body",
3654
- "name": "assignee"
3655
- }
3656
- ],
3657
- "path": "/observe/issues/:id/assign",
3658
- "readOnly": false
3659
- },
3660
- "get": {
3661
- "method": "GET",
3662
- "params": [
3663
- {
3664
- "in": "path",
3665
- "name": "id"
3666
- }
3667
- ],
3668
- "path": "/observe/issues/:id",
3669
- "readOnly": true
3670
- },
3671
- "list": {
3672
- "method": "GET",
3673
- "params": [
3674
- {
3675
- "in": "query",
3676
- "name": "status"
3677
- },
3678
- {
3679
- "in": "query",
3680
- "name": "assignee"
3681
- },
3682
- {
3683
- "in": "query",
3684
- "name": "limit"
3685
- }
3686
- ],
3687
- "path": "/observe/issues",
3688
- "readOnly": true
3689
- },
3690
- "resolve": {
3691
- "method": "POST",
3692
- "params": [
3693
- {
3694
- "in": "path",
3695
- "name": "id"
3696
- }
3697
- ],
3698
- "path": "/observe/issues/:id/resolve",
3699
- "readOnly": false
3700
- }
3701
- },
3702
- "keys": {
3703
- "create": {
3704
- "method": "POST",
3705
- "params": [
3706
- {
3707
- "in": "body",
3708
- "name": "environment"
3709
- },
3710
- {
3711
- "in": "body",
3712
- "name": "name"
3713
- },
3714
- {
3715
- "in": "body",
3716
- "name": "kind"
3717
- }
3718
- ],
3719
- "path": "/observe/keys",
3720
- "readOnly": false
3721
- },
3722
- "list": {
3723
- "method": "GET",
3724
- "params": [
3725
- {
3726
- "in": "query",
3727
- "name": "environment"
3728
- }
3729
- ],
3730
- "path": "/observe/keys",
3731
- "readOnly": true
3732
- },
3733
- "revoke": {
3734
- "method": "POST",
3735
- "params": [
3736
- {
3737
- "in": "path",
3738
- "name": "id"
3739
- }
3740
- ],
3741
- "path": "/observe/keys/:id/revoke",
3742
- "readOnly": false
3743
- }
3744
- },
3745
- "logs": {
3746
- "search": {
3747
- "method": "GET",
3748
- "params": [
3749
- {
3750
- "in": "query",
3751
- "name": "environment"
3752
- },
3753
- {
3754
- "in": "query",
3755
- "name": "service"
3756
- },
3757
- {
3758
- "in": "query",
3759
- "name": "severityIn"
3760
- },
3761
- {
3762
- "in": "query",
3763
- "name": "search"
3764
- },
3765
- {
3766
- "in": "query",
3767
- "name": "traceId"
3768
- },
3769
- {
3770
- "in": "query",
3771
- "name": "from"
3772
- },
3773
- {
3774
- "in": "query",
3775
- "name": "to"
3776
- },
3777
- {
3778
- "in": "query",
3779
- "name": "limit"
3780
- },
3781
- {
3782
- "in": "query",
3783
- "name": "cursor"
3784
- }
3785
- ],
3786
- "path": "/observe/logs/search",
3787
- "readOnly": true
3788
- },
3789
- "tail": {
3790
- "method": "GET",
3791
- "params": [
3792
- {
3793
- "in": "query",
3794
- "name": "environment"
3795
- },
3796
- {
3797
- "in": "query",
3798
- "name": "service"
3799
- },
3800
- {
3801
- "in": "query",
3802
- "name": "severityIn"
3803
- },
3804
- {
3805
- "in": "query",
3806
- "name": "cursor"
3807
- }
3808
- ],
3809
- "path": "/observe/logs/tail",
3810
- "readOnly": true
3811
- }
3812
- }
3813
- },
3814
3624
  "organization": {
3815
3625
  "$root": {
3816
3626
  "create": {
@@ -4464,6 +4274,17 @@ var bindings = {
4464
4274
  }
4465
4275
  },
4466
4276
  "product": {
4277
+ "accept-invitation": {
4278
+ "method": "POST",
4279
+ "params": [
4280
+ {
4281
+ "in": "path",
4282
+ "name": "token"
4283
+ }
4284
+ ],
4285
+ "path": "/governance/api/v1/invitations/:token/accept",
4286
+ "readOnly": false
4287
+ },
4467
4288
  "create": {
4468
4289
  "method": "POST",
4469
4290
  "params": [
@@ -4483,6 +4304,25 @@ var bindings = {
4483
4304
  "path": "/governance/api/v1/products",
4484
4305
  "readOnly": false
4485
4306
  },
4307
+ "invite": {
4308
+ "method": "POST",
4309
+ "params": [
4310
+ {
4311
+ "in": "path",
4312
+ "name": "productId"
4313
+ },
4314
+ {
4315
+ "in": "body",
4316
+ "name": "email"
4317
+ },
4318
+ {
4319
+ "in": "body",
4320
+ "name": "role"
4321
+ }
4322
+ ],
4323
+ "path": "/governance/api/v1/products/:productId/invitations",
4324
+ "readOnly": false
4325
+ },
4486
4326
  "list": {
4487
4327
  "method": "GET",
4488
4328
  "params": [
@@ -4494,7 +4334,7 @@ var bindings = {
4494
4334
  "path": "/governance/api/v1/products",
4495
4335
  "readOnly": true
4496
4336
  },
4497
- "list-access": {
4337
+ "list-invitations": {
4498
4338
  "method": "GET",
4499
4339
  "params": [
4500
4340
  {
@@ -4502,7 +4342,7 @@ var bindings = {
4502
4342
  "name": "productId"
4503
4343
  }
4504
4344
  ],
4505
- "path": "/governance/api/v1/products/:productId/access",
4345
+ "path": "/governance/api/v1/products/:productId/invitations",
4506
4346
  "readOnly": true
4507
4347
  },
4508
4348
  "list-members": {
@@ -4527,19 +4367,19 @@ var bindings = {
4527
4367
  "path": "/governance/api/v1/products/:productId/roles",
4528
4368
  "readOnly": true
4529
4369
  },
4530
- "revoke-access": {
4531
- "method": "DELETE",
4370
+ "revoke-invitation": {
4371
+ "method": "POST",
4532
4372
  "params": [
4533
4373
  {
4534
- "in": "path",
4374
+ "in": "body",
4535
4375
  "name": "productId"
4536
4376
  },
4537
4377
  {
4538
- "in": "path",
4539
- "name": "userId"
4378
+ "in": "body",
4379
+ "name": "invitationId"
4540
4380
  }
4541
4381
  ],
4542
- "path": "/governance/api/v1/products/:productId/access/:userId",
4382
+ "path": "/governance/api/v1/products/revoke-invitation",
4543
4383
  "readOnly": false
4544
4384
  },
4545
4385
  "select": {
@@ -4553,29 +4393,6 @@ var bindings = {
4553
4393
  "path": "/governance/api/v1/products/select",
4554
4394
  "readOnly": false
4555
4395
  },
4556
- "set-access": {
4557
- "method": "PUT",
4558
- "params": [
4559
- {
4560
- "in": "path",
4561
- "name": "productId"
4562
- },
4563
- {
4564
- "in": "path",
4565
- "name": "userId"
4566
- },
4567
- {
4568
- "in": "body",
4569
- "name": "role"
4570
- },
4571
- {
4572
- "in": "body",
4573
- "name": "roleId"
4574
- }
4575
- ],
4576
- "path": "/governance/api/v1/products/:productId/access/:userId",
4577
- "readOnly": false
4578
- },
4579
4396
  "update": {
4580
4397
  "method": "PATCH",
4581
4398
  "params": [
@@ -4586,10 +4403,6 @@ var bindings = {
4586
4403
  {
4587
4404
  "in": "body",
4588
4405
  "name": "name"
4589
- },
4590
- {
4591
- "in": "body",
4592
- "name": "description"
4593
4406
  }
4594
4407
  ],
4595
4408
  "path": "/governance/api/v1/products/:productId",
@@ -4780,160 +4593,6 @@ var bindings = {
4780
4593
  "path": "/governance/api/v1/organizations/:organizationId/security/mfa/enable",
4781
4594
  "readOnly": false
4782
4595
  }
4783
- },
4784
- "support-thread": {
4785
- "create": {
4786
- "method": "POST",
4787
- "params": [
4788
- {
4789
- "in": "body",
4790
- "name": "title"
4791
- },
4792
- {
4793
- "in": "body",
4794
- "name": "body"
4795
- }
4796
- ],
4797
- "path": "/governance/api/v1/support/threads",
4798
- "readOnly": false
4799
- },
4800
- "get": {
4801
- "method": "GET",
4802
- "params": [
4803
- {
4804
- "in": "path",
4805
- "name": "id"
4806
- }
4807
- ],
4808
- "path": "/governance/api/v1/support/threads/:id",
4809
- "readOnly": true
4810
- },
4811
- "reply": {
4812
- "method": "POST",
4813
- "params": [
4814
- {
4815
- "in": "path",
4816
- "name": "id"
4817
- },
4818
- {
4819
- "in": "body",
4820
- "name": "body"
4821
- }
4822
- ],
4823
- "path": "/governance/api/v1/support/threads/:id/messages",
4824
- "readOnly": false
4825
- }
4826
- },
4827
- "support-threads": {
4828
- "list": {
4829
- "method": "GET",
4830
- "path": "/governance/api/v1/support/threads",
4831
- "readOnly": true
4832
- }
4833
- }
4834
- },
4835
- "playground": {
4836
- "analytics": {
4837
- "overview": {
4838
- "method": "POST",
4839
- "params": [
4840
- {
4841
- "in": "body",
4842
- "name": "limit"
4843
- }
4844
- ],
4845
- "path": "/playground/analytics/overview",
4846
- "readOnly": true
4847
- }
4848
- },
4849
- "billing": {
4850
- "entitlements": {
4851
- "method": "POST",
4852
- "path": "/playground/billing/entitlements",
4853
- "readOnly": true
4854
- },
4855
- "record-usage": {
4856
- "method": "POST",
4857
- "params": [
4858
- {
4859
- "in": "body",
4860
- "name": "value"
4861
- }
4862
- ],
4863
- "path": "/playground/billing/usage",
4864
- "readOnly": false
4865
- }
4866
- },
4867
- "clickup": {
4868
- "create-task": {
4869
- "method": "POST",
4870
- "params": [
4871
- {
4872
- "in": "body",
4873
- "name": "listId"
4874
- },
4875
- {
4876
- "in": "body",
4877
- "name": "name"
4878
- }
4879
- ],
4880
- "path": "/playground/clickup/tasks",
4881
- "readOnly": false
4882
- },
4883
- "get-last-webhook": {
4884
- "method": "GET",
4885
- "path": "/playground/clickup/webhooks/last",
4886
- "readOnly": true
4887
- },
4888
- "get-overview": {
4889
- "method": "GET",
4890
- "path": "/playground/clickup/overview",
4891
- "readOnly": true
4892
- }
4893
- },
4894
- "gdrive": {
4895
- "get-last-change": {
4896
- "method": "GET",
4897
- "path": "/playground/gdrive/changes/last",
4898
- "readOnly": true
4899
- },
4900
- "read-file": {
4901
- "method": "POST",
4902
- "params": [
4903
- {
4904
- "in": "body",
4905
- "name": "fileId"
4906
- }
4907
- ],
4908
- "path": "/playground/gdrive/file",
4909
- "readOnly": true
4910
- }
4911
- },
4912
- "googleads": {
4913
- "read-customer": {
4914
- "method": "POST",
4915
- "path": "/playground/googleads/customer",
4916
- "readOnly": true
4917
- }
4918
- },
4919
- "lifecycle": {
4920
- "get-state": {
4921
- "method": "GET",
4922
- "path": "/playground/lifecycle/state",
4923
- "readOnly": true
4924
- },
4925
- "list-events": {
4926
- "method": "GET",
4927
- "path": "/playground/lifecycle/events",
4928
- "readOnly": true
4929
- }
4930
- },
4931
- "webhook": {
4932
- "get-last": {
4933
- "method": "GET",
4934
- "path": "/playground/webhooks/last",
4935
- "readOnly": true
4936
- }
4937
4596
  }
4938
4597
  },
4939
4598
  "realtime": {