@lessly/sdk-app 0.1.11

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 ADDED
@@ -0,0 +1,932 @@
1
+ 'use strict';
2
+
3
+ // src/runtime/errors.ts
4
+ var LesslyApiError = class extends Error {
5
+ status;
6
+ code;
7
+ body;
8
+ constructor(status, code, message, body) {
9
+ super(message);
10
+ this.name = "LesslyApiError";
11
+ this.status = status;
12
+ this.code = code;
13
+ this.body = body;
14
+ }
15
+ };
16
+ function parseErrorBody(body, status) {
17
+ const b = typeof body === "object" && body !== null ? body : null;
18
+ const code = b?.error?.code ?? b?.code ?? null;
19
+ const message = b?.error?.message ?? b?.message ?? `Request failed with status ${status}`;
20
+ return new LesslyApiError(status, code, message, body);
21
+ }
22
+
23
+ // src/runtime/csrf.ts
24
+ var CSRF_COOKIE = "lessly_csrf";
25
+ function readCsrfCookie() {
26
+ if (typeof document === "undefined" || !document) return null;
27
+ const match = document.cookie.match(new RegExp(`(?:^|; )${CSRF_COOKIE}=([^;]*)`));
28
+ return match ? decodeURIComponent(match[1]) : null;
29
+ }
30
+
31
+ // src/runtime/request.ts
32
+ var MUTATING = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
33
+ function pathTokenNames(path) {
34
+ const names = /* @__PURE__ */ new Set();
35
+ const re = /:([A-Za-z0-9_]+)/g;
36
+ let m;
37
+ while ((m = re.exec(path)) !== null) names.add(m[1]);
38
+ return names;
39
+ }
40
+ function placementFor(key, binding, tokens) {
41
+ if (binding.params) {
42
+ const spec = binding.params.find((p) => p.name === key);
43
+ if (spec) return spec.in;
44
+ }
45
+ if (tokens.has(key)) return "path";
46
+ return binding.method === "GET" || binding.method === "DELETE" ? "query" : "body";
47
+ }
48
+ function resolveRequest(binding, input = {}) {
49
+ const tokens = pathTokenNames(binding.path);
50
+ const query = {};
51
+ const body = {};
52
+ const pathValues = {};
53
+ for (const [k, v] of Object.entries(input)) {
54
+ const where = placementFor(k, binding, tokens);
55
+ if (where === "path") pathValues[k] = v;
56
+ else if (where === "query") query[k] = v;
57
+ else body[k] = v;
58
+ }
59
+ let path = binding.path;
60
+ for (const token of tokens) {
61
+ const val = pathValues[token];
62
+ if (val === void 0) throw new Error(`Missing path parameter "${token}" for ${binding.path}`);
63
+ path = path.replace(`:${token}`, encodeURIComponent(String(val)));
64
+ }
65
+ return { path, query, body: Object.keys(body).length > 0 ? body : void 0 };
66
+ }
67
+ function buildUrl(baseUrl, path, query) {
68
+ const url = new URL(baseUrl.replace(/\/$/, "") + path);
69
+ for (const [k, v] of Object.entries(query)) {
70
+ if (v === void 0 || v === null) continue;
71
+ if (Array.isArray(v)) v.forEach((item) => url.searchParams.append(k, String(item)));
72
+ else url.searchParams.append(k, String(v));
73
+ }
74
+ return url.toString();
75
+ }
76
+ function safeJson(text) {
77
+ try {
78
+ return JSON.parse(text);
79
+ } catch {
80
+ return text;
81
+ }
82
+ }
83
+ async function executeRequest(opts, binding, input) {
84
+ const { path, query, body } = resolveRequest(binding, input);
85
+ const url = buildUrl(opts.baseUrl, path, query);
86
+ const doFetch = opts.fetch ?? globalThis.fetch;
87
+ const headers = new Headers();
88
+ headers.set("X-Product-Id", opts.productId);
89
+ if (body !== void 0) headers.set("Content-Type", "application/json");
90
+ if (MUTATING.has(binding.method)) {
91
+ const token = (opts.getCsrfToken ?? readCsrfCookie)();
92
+ if (token) headers.set("X-CSRF-Token", token);
93
+ }
94
+ const requestInit = { method: binding.method, headers, credentials: "include" };
95
+ if (body !== void 0) requestInit.body = JSON.stringify(body);
96
+ const res = await doFetch(url, requestInit);
97
+ const text = await res.text();
98
+ const parsed = text ? safeJson(text) : null;
99
+ if (!res.ok) throw parseErrorBody(parsed, res.status);
100
+ return parsed;
101
+ }
102
+
103
+ // src/gen/bindings.gen.ts
104
+ var bindings = {
105
+ "organization": {
106
+ "auth": {
107
+ "me": {
108
+ "method": "GET",
109
+ "path": "/governance/api/v1/auth/me",
110
+ "readOnly": true
111
+ }
112
+ },
113
+ "bindings": {
114
+ "list": {
115
+ "method": "GET",
116
+ "params": [
117
+ {
118
+ "in": "path",
119
+ "name": "productId"
120
+ },
121
+ {
122
+ "in": "path",
123
+ "name": "domainId"
124
+ }
125
+ ],
126
+ "path": "/governance/api/v1/products/:productId/domains/:domainId/bindings",
127
+ "readOnly": true
128
+ }
129
+ },
130
+ "clickup": {
131
+ "install": {
132
+ "method": "GET",
133
+ "path": "/governance/api/v1/connectors/clickup/install",
134
+ "readOnly": false
135
+ },
136
+ "list-installations": {
137
+ "method": "GET",
138
+ "path": "/governance/api/v1/connectors/clickup/installations",
139
+ "readOnly": true
140
+ }
141
+ },
142
+ "cloudflare": {
143
+ "install": {
144
+ "method": "GET",
145
+ "path": "/governance/api/v1/connectors/cloudflare/install",
146
+ "readOnly": false
147
+ }
148
+ },
149
+ "connectors": {
150
+ "attach": {
151
+ "method": "POST",
152
+ "params": [
153
+ {
154
+ "in": "body",
155
+ "name": "organizationId"
156
+ },
157
+ {
158
+ "in": "path",
159
+ "name": "id"
160
+ },
161
+ {
162
+ "in": "body",
163
+ "name": "productIds"
164
+ }
165
+ ],
166
+ "path": "/governance/api/v1/connectors/:id/attachments",
167
+ "readOnly": false
168
+ },
169
+ "delete": {
170
+ "method": "DELETE",
171
+ "params": [
172
+ {
173
+ "in": "path",
174
+ "name": "id"
175
+ }
176
+ ],
177
+ "path": "/governance/api/v1/connectors/:id/org",
178
+ "readOnly": false
179
+ },
180
+ "detach": {
181
+ "method": "DELETE",
182
+ "params": [
183
+ {
184
+ "in": "path",
185
+ "name": "id"
186
+ },
187
+ {
188
+ "in": "path",
189
+ "name": "productId"
190
+ }
191
+ ],
192
+ "path": "/governance/api/v1/connectors/:id/attachments/:productId",
193
+ "readOnly": false
194
+ },
195
+ "list": {
196
+ "method": "GET",
197
+ "params": [
198
+ {
199
+ "in": "query",
200
+ "name": "productId"
201
+ }
202
+ ],
203
+ "path": "/governance/api/v1/connectors/list",
204
+ "readOnly": true
205
+ },
206
+ "list-attachments": {
207
+ "method": "GET",
208
+ "params": [
209
+ {
210
+ "in": "path",
211
+ "name": "id"
212
+ }
213
+ ],
214
+ "path": "/governance/api/v1/connectors/:id/attachments",
215
+ "readOnly": true
216
+ },
217
+ "list-org": {
218
+ "method": "GET",
219
+ "params": [
220
+ {
221
+ "in": "path",
222
+ "name": "organizationId"
223
+ }
224
+ ],
225
+ "path": "/governance/api/v1/organizations/:organizationId/connectors",
226
+ "readOnly": true
227
+ },
228
+ "remove": {
229
+ "method": "DELETE",
230
+ "params": [
231
+ {
232
+ "in": "path",
233
+ "name": "id"
234
+ }
235
+ ],
236
+ "path": "/governance/api/v1/connectors/:id",
237
+ "readOnly": false
238
+ }
239
+ },
240
+ "domains": {
241
+ "add": {
242
+ "method": "POST",
243
+ "params": [
244
+ {
245
+ "in": "path",
246
+ "name": "productId"
247
+ },
248
+ {
249
+ "in": "body",
250
+ "name": "domain"
251
+ }
252
+ ],
253
+ "path": "/governance/api/v1/products/:productId/domains",
254
+ "readOnly": false
255
+ },
256
+ "get": {
257
+ "method": "GET",
258
+ "params": [
259
+ {
260
+ "in": "path",
261
+ "name": "productId"
262
+ },
263
+ {
264
+ "in": "path",
265
+ "name": "domainId"
266
+ }
267
+ ],
268
+ "path": "/governance/api/v1/products/:productId/domains/:domainId",
269
+ "readOnly": true
270
+ },
271
+ "list": {
272
+ "method": "GET",
273
+ "params": [
274
+ {
275
+ "in": "path",
276
+ "name": "productId"
277
+ }
278
+ ],
279
+ "path": "/governance/api/v1/products/:productId/domains",
280
+ "readOnly": true
281
+ },
282
+ "remove": {
283
+ "method": "DELETE",
284
+ "params": [
285
+ {
286
+ "in": "path",
287
+ "name": "productId"
288
+ },
289
+ {
290
+ "in": "path",
291
+ "name": "domainId"
292
+ }
293
+ ],
294
+ "path": "/governance/api/v1/products/:productId/domains/:domainId",
295
+ "readOnly": false
296
+ }
297
+ },
298
+ "extensions": {
299
+ "install": {
300
+ "method": "POST",
301
+ "params": [
302
+ {
303
+ "in": "path",
304
+ "name": "productId"
305
+ },
306
+ {
307
+ "in": "path",
308
+ "name": "extensionId"
309
+ }
310
+ ],
311
+ "path": "/governance/api/v1/products/:productId/extensions/:extensionId/install",
312
+ "readOnly": false
313
+ },
314
+ "list": {
315
+ "method": "GET",
316
+ "path": "/governance/api/v1/extensions",
317
+ "readOnly": true
318
+ },
319
+ "list-installed": {
320
+ "method": "GET",
321
+ "params": [
322
+ {
323
+ "in": "path",
324
+ "name": "productId"
325
+ }
326
+ ],
327
+ "path": "/governance/api/v1/products/:productId/extensions",
328
+ "readOnly": true
329
+ },
330
+ "uninstall": {
331
+ "method": "POST",
332
+ "params": [
333
+ {
334
+ "in": "path",
335
+ "name": "productId"
336
+ },
337
+ {
338
+ "in": "path",
339
+ "name": "extensionId"
340
+ }
341
+ ],
342
+ "path": "/governance/api/v1/products/:productId/extensions/:extensionId/uninstall",
343
+ "readOnly": false
344
+ }
345
+ },
346
+ "gdrive": {
347
+ "install": {
348
+ "method": "GET",
349
+ "path": "/governance/api/v1/connectors/gdrive/install",
350
+ "readOnly": false
351
+ }
352
+ },
353
+ "github": {
354
+ "install": {
355
+ "method": "GET",
356
+ "path": "/governance/api/v1/connectors/github/install",
357
+ "readOnly": false
358
+ },
359
+ "list-installations": {
360
+ "method": "GET",
361
+ "path": "/governance/api/v1/connectors/github/installations",
362
+ "readOnly": true
363
+ }
364
+ },
365
+ "googleads": {
366
+ "install": {
367
+ "method": "GET",
368
+ "params": [
369
+ {
370
+ "in": "query",
371
+ "name": "organizationId"
372
+ }
373
+ ],
374
+ "path": "/governance/api/v1/connectors/googleads/install",
375
+ "readOnly": false
376
+ }
377
+ },
378
+ "member": {
379
+ "accept-invite": {
380
+ "method": "POST",
381
+ "params": [
382
+ {
383
+ "in": "body",
384
+ "name": "token"
385
+ }
386
+ ],
387
+ "path": "/governance/api/v1/organizations/invitations/accept",
388
+ "readOnly": false
389
+ },
390
+ "invite": {
391
+ "method": "POST",
392
+ "params": [
393
+ {
394
+ "in": "path",
395
+ "name": "organizationId"
396
+ },
397
+ {
398
+ "in": "body",
399
+ "name": "email"
400
+ },
401
+ {
402
+ "in": "body",
403
+ "name": "role"
404
+ },
405
+ {
406
+ "in": "body",
407
+ "name": "productShares"
408
+ }
409
+ ],
410
+ "path": "/governance/api/v1/organizations/:organizationId/invitations",
411
+ "readOnly": false
412
+ },
413
+ "list": {
414
+ "method": "GET",
415
+ "params": [
416
+ {
417
+ "in": "path",
418
+ "name": "organizationId"
419
+ }
420
+ ],
421
+ "path": "/governance/api/v1/organizations/:organizationId/members",
422
+ "readOnly": true
423
+ },
424
+ "list-invitations": {
425
+ "method": "GET",
426
+ "params": [
427
+ {
428
+ "in": "path",
429
+ "name": "organizationId"
430
+ }
431
+ ],
432
+ "path": "/governance/api/v1/organizations/:organizationId/invitations",
433
+ "readOnly": true
434
+ },
435
+ "list-product-access": {
436
+ "method": "GET",
437
+ "params": [
438
+ {
439
+ "in": "path",
440
+ "name": "organizationId"
441
+ },
442
+ {
443
+ "in": "path",
444
+ "name": "userId"
445
+ }
446
+ ],
447
+ "path": "/governance/api/v1/organizations/:organizationId/members/:userId/products",
448
+ "readOnly": true
449
+ },
450
+ "remove": {
451
+ "method": "DELETE",
452
+ "params": [
453
+ {
454
+ "in": "path",
455
+ "name": "organizationId"
456
+ },
457
+ {
458
+ "in": "path",
459
+ "name": "userId"
460
+ }
461
+ ],
462
+ "path": "/governance/api/v1/organizations/:organizationId/members/:userId",
463
+ "readOnly": false
464
+ },
465
+ "revoke-invitation": {
466
+ "method": "DELETE",
467
+ "params": [
468
+ {
469
+ "in": "path",
470
+ "name": "organizationId"
471
+ },
472
+ {
473
+ "in": "path",
474
+ "name": "invitationId"
475
+ }
476
+ ],
477
+ "path": "/governance/api/v1/organizations/:organizationId/invitations/:invitationId",
478
+ "readOnly": false
479
+ },
480
+ "set-role": {
481
+ "method": "PATCH",
482
+ "params": [
483
+ {
484
+ "in": "path",
485
+ "name": "organizationId"
486
+ },
487
+ {
488
+ "in": "path",
489
+ "name": "userId"
490
+ },
491
+ {
492
+ "in": "body",
493
+ "name": "role"
494
+ }
495
+ ],
496
+ "path": "/governance/api/v1/organizations/:organizationId/members/:userId/role",
497
+ "readOnly": false
498
+ },
499
+ "share-product": {
500
+ "method": "POST",
501
+ "params": [
502
+ {
503
+ "in": "path",
504
+ "name": "organizationId"
505
+ },
506
+ {
507
+ "in": "path",
508
+ "name": "userId"
509
+ },
510
+ {
511
+ "in": "body",
512
+ "name": "productId"
513
+ },
514
+ {
515
+ "in": "body",
516
+ "name": "role"
517
+ },
518
+ {
519
+ "in": "body",
520
+ "name": "expiresAt"
521
+ },
522
+ {
523
+ "in": "body",
524
+ "name": "permissions"
525
+ },
526
+ {
527
+ "in": "body",
528
+ "name": "roleId"
529
+ }
530
+ ],
531
+ "path": "/governance/api/v1/organizations/:organizationId/members/:userId/products",
532
+ "readOnly": false
533
+ },
534
+ "unshare-product": {
535
+ "method": "DELETE",
536
+ "params": [
537
+ {
538
+ "in": "path",
539
+ "name": "organizationId"
540
+ },
541
+ {
542
+ "in": "path",
543
+ "name": "userId"
544
+ },
545
+ {
546
+ "in": "path",
547
+ "name": "productId"
548
+ }
549
+ ],
550
+ "path": "/governance/api/v1/organizations/:organizationId/members/:userId/products/:productId",
551
+ "readOnly": false
552
+ }
553
+ },
554
+ "members": {
555
+ "assign-role": {
556
+ "method": "PUT",
557
+ "params": [
558
+ {
559
+ "in": "path",
560
+ "name": "productId"
561
+ },
562
+ {
563
+ "in": "path",
564
+ "name": "memberId"
565
+ },
566
+ {
567
+ "in": "body",
568
+ "name": "roleId"
569
+ }
570
+ ],
571
+ "path": "/governance/api/v1/products/:productId/members/:memberId/role",
572
+ "readOnly": false
573
+ }
574
+ },
575
+ "permission": {
576
+ "catalog": {
577
+ "method": "GET",
578
+ "path": "/governance/api/v1/organizations/permission-catalog",
579
+ "readOnly": true
580
+ }
581
+ },
582
+ "product": {
583
+ "accept-invitation": {
584
+ "method": "POST",
585
+ "params": [
586
+ {
587
+ "in": "path",
588
+ "name": "token"
589
+ }
590
+ ],
591
+ "path": "/governance/api/v1/invitations/:token/accept",
592
+ "readOnly": false
593
+ },
594
+ "create": {
595
+ "method": "POST",
596
+ "params": [
597
+ {
598
+ "in": "body",
599
+ "name": "name"
600
+ },
601
+ {
602
+ "in": "body",
603
+ "name": "organizationName"
604
+ }
605
+ ],
606
+ "path": "/governance/api/v1/products",
607
+ "readOnly": false
608
+ },
609
+ "invite": {
610
+ "method": "POST",
611
+ "params": [
612
+ {
613
+ "in": "path",
614
+ "name": "productId"
615
+ },
616
+ {
617
+ "in": "body",
618
+ "name": "email"
619
+ }
620
+ ],
621
+ "path": "/governance/api/v1/products/:productId/invitations",
622
+ "readOnly": false
623
+ },
624
+ "list": {
625
+ "method": "GET",
626
+ "params": [
627
+ {
628
+ "in": "query",
629
+ "name": "organizationId"
630
+ }
631
+ ],
632
+ "path": "/governance/api/v1/products",
633
+ "readOnly": true
634
+ },
635
+ "list-invitations": {
636
+ "method": "GET",
637
+ "params": [
638
+ {
639
+ "in": "path",
640
+ "name": "productId"
641
+ }
642
+ ],
643
+ "path": "/governance/api/v1/products/:productId/invitations",
644
+ "readOnly": true
645
+ },
646
+ "list-members": {
647
+ "method": "GET",
648
+ "params": [
649
+ {
650
+ "in": "path",
651
+ "name": "productId"
652
+ }
653
+ ],
654
+ "path": "/governance/api/v1/products/:productId/members",
655
+ "readOnly": true
656
+ },
657
+ "revoke-invitation": {
658
+ "method": "POST",
659
+ "params": [
660
+ {
661
+ "in": "body",
662
+ "name": "productId"
663
+ },
664
+ {
665
+ "in": "body",
666
+ "name": "invitationId"
667
+ }
668
+ ],
669
+ "path": "/governance/api/v1/products/revoke-invitation",
670
+ "readOnly": false
671
+ },
672
+ "select": {
673
+ "method": "POST",
674
+ "params": [
675
+ {
676
+ "in": "body",
677
+ "name": "productId"
678
+ }
679
+ ],
680
+ "path": "/governance/api/v1/products/select",
681
+ "readOnly": false
682
+ }
683
+ },
684
+ "roles": {
685
+ "create": {
686
+ "method": "POST",
687
+ "params": [
688
+ {
689
+ "in": "path",
690
+ "name": "orgId"
691
+ },
692
+ {
693
+ "in": "body",
694
+ "name": "name"
695
+ },
696
+ {
697
+ "in": "body",
698
+ "name": "allow"
699
+ },
700
+ {
701
+ "in": "body",
702
+ "name": "deny"
703
+ }
704
+ ],
705
+ "path": "/governance/api/v1/organizations/:orgId/roles",
706
+ "readOnly": false
707
+ },
708
+ "delete": {
709
+ "method": "DELETE",
710
+ "params": [
711
+ {
712
+ "in": "path",
713
+ "name": "orgId"
714
+ },
715
+ {
716
+ "in": "path",
717
+ "name": "roleId"
718
+ }
719
+ ],
720
+ "path": "/governance/api/v1/organizations/:orgId/roles/:roleId",
721
+ "readOnly": false
722
+ },
723
+ "get": {
724
+ "method": "GET",
725
+ "params": [
726
+ {
727
+ "in": "path",
728
+ "name": "orgId"
729
+ },
730
+ {
731
+ "in": "path",
732
+ "name": "roleId"
733
+ }
734
+ ],
735
+ "path": "/governance/api/v1/organizations/:orgId/roles/:roleId",
736
+ "readOnly": true
737
+ },
738
+ "list": {
739
+ "method": "GET",
740
+ "params": [
741
+ {
742
+ "in": "path",
743
+ "name": "orgId"
744
+ }
745
+ ],
746
+ "path": "/governance/api/v1/organizations/:orgId/roles",
747
+ "readOnly": true
748
+ },
749
+ "update": {
750
+ "method": "PATCH",
751
+ "params": [
752
+ {
753
+ "in": "path",
754
+ "name": "orgId"
755
+ },
756
+ {
757
+ "in": "path",
758
+ "name": "roleId"
759
+ },
760
+ {
761
+ "in": "body",
762
+ "name": "name"
763
+ },
764
+ {
765
+ "in": "body",
766
+ "name": "allow"
767
+ },
768
+ {
769
+ "in": "body",
770
+ "name": "deny"
771
+ }
772
+ ],
773
+ "path": "/governance/api/v1/organizations/:orgId/roles/:roleId",
774
+ "readOnly": false
775
+ }
776
+ }
777
+ },
778
+ "playground": {
779
+ "analytics": {
780
+ "overview": {
781
+ "method": "POST",
782
+ "params": [
783
+ {
784
+ "in": "body",
785
+ "name": "limit"
786
+ }
787
+ ],
788
+ "path": "/governance/analytics/overview",
789
+ "readOnly": true
790
+ }
791
+ },
792
+ "billing": {
793
+ "entitlements": {
794
+ "method": "POST",
795
+ "path": "/governance/billing/entitlements",
796
+ "readOnly": true
797
+ },
798
+ "record-usage": {
799
+ "method": "POST",
800
+ "params": [
801
+ {
802
+ "in": "body",
803
+ "name": "value"
804
+ }
805
+ ],
806
+ "path": "/governance/billing/usage",
807
+ "readOnly": false
808
+ }
809
+ },
810
+ "clickup": {
811
+ "create-task": {
812
+ "method": "POST",
813
+ "params": [
814
+ {
815
+ "in": "body",
816
+ "name": "listId"
817
+ },
818
+ {
819
+ "in": "body",
820
+ "name": "name"
821
+ }
822
+ ],
823
+ "path": "/governance/clickup/tasks",
824
+ "readOnly": false
825
+ },
826
+ "get-last-webhook": {
827
+ "method": "GET",
828
+ "path": "/governance/clickup/webhooks/last",
829
+ "readOnly": true
830
+ },
831
+ "get-overview": {
832
+ "method": "GET",
833
+ "path": "/governance/clickup/overview",
834
+ "readOnly": true
835
+ }
836
+ },
837
+ "gdrive": {
838
+ "get-last-change": {
839
+ "method": "GET",
840
+ "path": "/governance/gdrive/changes/last",
841
+ "readOnly": true
842
+ },
843
+ "read-file": {
844
+ "method": "POST",
845
+ "params": [
846
+ {
847
+ "in": "body",
848
+ "name": "fileId"
849
+ }
850
+ ],
851
+ "path": "/governance/gdrive/file",
852
+ "readOnly": true
853
+ }
854
+ },
855
+ "googleads": {
856
+ "read-customer": {
857
+ "method": "POST",
858
+ "path": "/governance/googleads/customer",
859
+ "readOnly": true
860
+ }
861
+ },
862
+ "lifecycle": {
863
+ "get-state": {
864
+ "method": "GET",
865
+ "path": "/governance/lifecycle/state",
866
+ "readOnly": true
867
+ },
868
+ "list-events": {
869
+ "method": "GET",
870
+ "path": "/governance/lifecycle/events",
871
+ "readOnly": true
872
+ }
873
+ },
874
+ "webhook": {
875
+ "get-last": {
876
+ "method": "GET",
877
+ "path": "/governance/webhooks/last",
878
+ "readOnly": true
879
+ }
880
+ }
881
+ }
882
+ };
883
+
884
+ // src/runtime/createLesslyApp.ts
885
+ function actionFn(opts, binding) {
886
+ return (input) => executeRequest(opts, binding, input);
887
+ }
888
+ function resourceProxy(opts, actions) {
889
+ const cache = {};
890
+ return new Proxy(cache, {
891
+ get(_t, prop) {
892
+ if (typeof prop !== "string" || !Object.hasOwn(actions, prop)) return void 0;
893
+ return cache[prop] ??= actionFn(opts, actions[prop]);
894
+ }
895
+ });
896
+ }
897
+ function namespaceProxy(opts, resources) {
898
+ const cache = {};
899
+ return new Proxy(cache, {
900
+ get(_t, prop) {
901
+ if (typeof prop !== "string" || !Object.hasOwn(resources, prop)) return void 0;
902
+ return cache[prop] ??= resourceProxy(opts, resources[prop]);
903
+ }
904
+ });
905
+ }
906
+ function createLesslyApp(opts) {
907
+ const map = bindings;
908
+ const nsCache = {};
909
+ const base = {
910
+ call(toolName, input) {
911
+ const parts = toolName.split("_");
912
+ if (parts.length < 3) return Promise.reject(new Error(`Unknown tool: ${toolName}`));
913
+ const [ns] = parts;
914
+ const action = parts[parts.length - 1];
915
+ const resource = parts.slice(1, -1).join("-");
916
+ const binding = map[ns]?.[resource]?.[action];
917
+ if (!binding) return Promise.reject(new Error(`Unknown tool: ${toolName}`));
918
+ return executeRequest(opts, binding, input);
919
+ }
920
+ };
921
+ return new Proxy(base, {
922
+ get(target, prop) {
923
+ if (typeof prop === "string" && Object.hasOwn(map, prop)) return nsCache[prop] ??= namespaceProxy(opts, map[prop]);
924
+ return target[prop];
925
+ }
926
+ });
927
+ }
928
+
929
+ exports.LesslyApiError = LesslyApiError;
930
+ exports.createLesslyApp = createLesslyApp;
931
+ //# sourceMappingURL=index.cjs.map
932
+ //# sourceMappingURL=index.cjs.map