@vibes.diy/api-types 2.0.0-dev-cli-e → 2.0.0-dev-cli-f

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/common.js ADDED
@@ -0,0 +1,207 @@
1
+ import { Result } from "@adviser/cement";
2
+ import { type } from "arktype";
3
+ import { CoercedDate } from "@vibes.diy/call-ai-v2";
4
+ export const ClerkClaimParams = type({
5
+ "nick?": "string",
6
+ email: "string",
7
+ email_verified: "boolean",
8
+ "external_id?": "string | null",
9
+ first: "string",
10
+ image_url: "string",
11
+ last: "string",
12
+ name: "string | null",
13
+ public_meta: "unknown",
14
+ });
15
+ export const ClerkClaim = type({
16
+ "azp?": "string",
17
+ "exp?": "number",
18
+ "iat?": "number",
19
+ "iss?": "string",
20
+ "jti?": "string",
21
+ "nbf?": "number",
22
+ params: ClerkClaimParams,
23
+ role: "string",
24
+ sub: "string",
25
+ userId: "string",
26
+ "aud?": "string | string[]",
27
+ "app_metadata?": "unknown",
28
+ });
29
+ export const FPCloudClaim = type({
30
+ "azp?": "string",
31
+ "iss?": "string",
32
+ "sub?": "string",
33
+ "aud?": "string | string[]",
34
+ "exp?": "number",
35
+ "nbf?": "number",
36
+ "iat?": "number",
37
+ "jti?": "string",
38
+ userId: "string",
39
+ email: "string.email",
40
+ "nickname?": "string",
41
+ "provider?": "'github' | 'google'",
42
+ created: CoercedDate,
43
+ tenants: type({
44
+ id: "string",
45
+ role: "'admin' | 'member' | 'owner'",
46
+ }).array(),
47
+ ledgers: type({
48
+ id: "string",
49
+ role: "'admin' | 'member' | 'owner'",
50
+ right: "'read' | 'write'",
51
+ }).array(),
52
+ selected: {
53
+ "appId?": "string",
54
+ tenant: "string",
55
+ ledger: "string",
56
+ },
57
+ });
58
+ export const dashAuthType = type({
59
+ type: "'clerk'|'device-id'|'ucan'",
60
+ token: "string",
61
+ });
62
+ export const vibeUserEnv = type("Record<string, string>");
63
+ const baseFileProps = type({
64
+ filename: type("string").narrow((s) => {
65
+ if (!s.startsWith("/"))
66
+ return false;
67
+ if (s.includes("//"))
68
+ return false;
69
+ if (s.includes("/../"))
70
+ return false;
71
+ if (s.includes("/./"))
72
+ return false;
73
+ return true;
74
+ }),
75
+ "entryPoint?": "boolean",
76
+ "mimetype?": "string",
77
+ });
78
+ export const VibeCodeBlock = type({
79
+ type: "'code-block'",
80
+ lang: "string",
81
+ content: "string",
82
+ }).and(baseFileProps);
83
+ export function isVibeCodeBlock(obj) {
84
+ return !(VibeCodeBlock(obj) instanceof type.errors);
85
+ }
86
+ export const VibeCodeRef = type({
87
+ type: "'code-ref'",
88
+ refId: "string",
89
+ }).and(baseFileProps);
90
+ export const VibeStrAssetBlock = type({
91
+ type: "'str-asset-block'",
92
+ content: "string",
93
+ }).and(baseFileProps);
94
+ export const VibeStrAssetRef = type({
95
+ type: "'str-asset-ref'",
96
+ refId: "string",
97
+ }).and(baseFileProps);
98
+ export const VibeUint8AssetBlock = type({
99
+ type: "'uint8-asset-block'",
100
+ content: type.instanceOf(Uint8Array),
101
+ }).and(baseFileProps);
102
+ export const VibeUint8AssetRef = type({
103
+ type: "'uint8-asset-ref'",
104
+ refId: "string",
105
+ }).and(baseFileProps);
106
+ export const vibeFile = type(VibeCodeBlock.or(VibeCodeRef).or(VibeStrAssetBlock).or(VibeStrAssetRef).or(VibeUint8AssetBlock).or(VibeUint8AssetRef));
107
+ export const resError = type({
108
+ type: "'vibes.diy.error'",
109
+ message: "string",
110
+ "code?": "string",
111
+ "stack?": "string[]",
112
+ });
113
+ export const FSMode = type("'production'|'dev'");
114
+ export const AppSlugUserSlug = type({
115
+ appSlug: "string",
116
+ userSlug: "string",
117
+ });
118
+ export const OptAppSlugUserSlug = type({
119
+ "appSlug?": "string",
120
+ userSlug: "string",
121
+ });
122
+ export const AppSlugOptUserSlug = type({
123
+ appSlug: "string",
124
+ "userSlug?": "string",
125
+ });
126
+ export const OptAppSlugOptUserSlug = type({
127
+ "appSlug?": "string",
128
+ "userSlug?": "string",
129
+ });
130
+ export const NeedOneAppSlugUserSlug = AppSlugUserSlug.or(OptAppSlugUserSlug).or(AppSlugOptUserSlug).or(OptAppSlugOptUserSlug);
131
+ export const msgBase = type({
132
+ tid: "string",
133
+ src: "string",
134
+ dst: "string",
135
+ ttl: "number",
136
+ payload: "unknown",
137
+ });
138
+ export function isMsgBase(obj) {
139
+ return !(msgBase(obj) instanceof type.errors);
140
+ }
141
+ export const w3cMessageEventBox = type({
142
+ type: "'MessageEvent'",
143
+ event: type({
144
+ data: "unknown",
145
+ origin: "string|null",
146
+ lastEventId: "string",
147
+ source: "unknown",
148
+ ports: "unknown",
149
+ }).partial(),
150
+ });
151
+ export const w3cCloseEventBox = type({
152
+ type: "'CloseEvent'",
153
+ event: type({
154
+ wasClean: "boolean",
155
+ code: "number",
156
+ reason: "string",
157
+ }),
158
+ });
159
+ export const w3cErrorEventBox = type({
160
+ type: "'ErrorEvent'",
161
+ event: type({
162
+ message: "string",
163
+ filename: "string",
164
+ lineno: "number",
165
+ colno: "number",
166
+ error: "unknown",
167
+ }).partial(),
168
+ });
169
+ export const w3CWebSocketEvent = w3cMessageEventBox.or(w3cCloseEventBox).or(w3cErrorEventBox);
170
+ export const Pager = type({
171
+ "limit?": "number",
172
+ "cursor?": "string",
173
+ });
174
+ export const ForeignInfo = type({ "givenEmail?": "string", "claims?": ClerkClaim });
175
+ export const InviteForeignInfo = ForeignInfo;
176
+ export const GrantListBase = type({
177
+ appSlug: "string",
178
+ userSlug: "string",
179
+ auth: dashAuthType,
180
+ pager: Pager,
181
+ });
182
+ export const Role = type("'editor' | 'viewer'");
183
+ export function parseArrayResult(items, match) {
184
+ if (!Array.isArray(items))
185
+ return [];
186
+ return items.map((item) => {
187
+ const r = match(item);
188
+ if (r instanceof type.errors)
189
+ return Result.Err(r.summary);
190
+ return Result.Ok(r);
191
+ });
192
+ }
193
+ export function parseArrayWarning(items, match) {
194
+ return parseArrayResult(items, match).reduce((acc, r, idx) => {
195
+ if (r.isErr()) {
196
+ acc.warning.push({ idx, txt: r.Err().message });
197
+ }
198
+ else {
199
+ acc.filtered.push(r.Ok());
200
+ }
201
+ return acc;
202
+ }, { filtered: [], warning: [] });
203
+ }
204
+ export function parseArray(items, match) {
205
+ return parseArrayWarning(items, match).filtered;
206
+ }
207
+ //# sourceMappingURL=common.js.map
package/common.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../jsr/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,cAAc,EAAE,SAAS;IACzB,cAAc,EAAE,eAAe;IAC/B,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,SAAS;CACvB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,gBAAgB;IACxB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,mBAAmB;IAC3B,eAAe,EAAE,SAAS;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QA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O,GAAG,CAAC;IACb,CAAC,EACD,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAyC,CACrE,CAAC;AACJ,CAAC;AAKD,MAAM,UAAU,UAAU,CAAiB,KAAc,EAAE,KAAQ;IACjE,OAAO,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC"}
@@ -0,0 +1,145 @@
1
+ export declare const ReqFPCloudToken: import("arktype/internal/variants/object.ts").ObjectType<{
2
+ type: "vibes.diy.req-fpcloud-token";
3
+ auth: {
4
+ type: "clerk" | "device-id" | "ucan";
5
+ token: string;
6
+ };
7
+ userSlug: string;
8
+ appSlug: string;
9
+ dbName: string;
10
+ }, {}>;
11
+ export type ReqFPCloudToken = typeof ReqFPCloudToken.infer;
12
+ export declare function isReqFPCloudToken(obj: unknown): obj is ReqFPCloudToken;
13
+ export declare const ResFPCloudTokenNoGrant: import("arktype/internal/variants/object.ts").ObjectType<{
14
+ type: "vibes.diy.res-fpcloud-token";
15
+ grant: "no-grant";
16
+ }, {}>;
17
+ export type ResFPCloudTokenNoGrant = typeof ResFPCloudTokenNoGrant.infer;
18
+ export declare function isResFPCloudTokenNoGrant(obj: unknown): obj is ResFPCloudTokenNoGrant;
19
+ export declare const Token: import("arktype/internal/variants/object.ts").ObjectType<{
20
+ expiresInSec: number;
21
+ token: string;
22
+ claims: {
23
+ azp?: string | undefined;
24
+ iss?: string | undefined;
25
+ sub?: string | undefined;
26
+ aud?: string | string[] | undefined;
27
+ exp?: number | undefined;
28
+ nbf?: number | undefined;
29
+ iat?: number | undefined;
30
+ jti?: string | undefined;
31
+ userId: string;
32
+ email: string;
33
+ nickname?: string | undefined;
34
+ provider?: "github" | "google" | undefined;
35
+ created: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
36
+ tenants: {
37
+ id: string;
38
+ role: "admin" | "member" | "owner";
39
+ }[];
40
+ ledgers: {
41
+ id: string;
42
+ role: "admin" | "member" | "owner";
43
+ right: "read" | "write";
44
+ }[];
45
+ selected: {
46
+ appId?: string | undefined;
47
+ tenant: string;
48
+ ledger: string;
49
+ };
50
+ };
51
+ }, {}>;
52
+ export type Token = typeof Token.infer;
53
+ export declare const ResFPCloudTokenGrant: import("arktype/internal/variants/object.ts").ObjectType<{
54
+ type: "vibes.diy.res-fpcloud-token";
55
+ grant: "invite-editor" | "invite-viewer" | "owner" | "public" | "request-editor" | "request-viewer";
56
+ token: {
57
+ expiresInSec: number;
58
+ token: string;
59
+ claims: {
60
+ azp?: string | undefined;
61
+ iss?: string | undefined;
62
+ sub?: string | undefined;
63
+ aud?: string | string[] | undefined;
64
+ exp?: number | undefined;
65
+ nbf?: number | undefined;
66
+ iat?: number | undefined;
67
+ jti?: string | undefined;
68
+ userId: string;
69
+ email: string;
70
+ nickname?: string | undefined;
71
+ provider?: "github" | "google" | undefined;
72
+ created: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
73
+ tenants: {
74
+ id: string;
75
+ role: "admin" | "member" | "owner";
76
+ }[];
77
+ ledgers: {
78
+ id: string;
79
+ role: "admin" | "member" | "owner";
80
+ right: "read" | "write";
81
+ }[];
82
+ selected: {
83
+ appId?: string | undefined;
84
+ tenant: string;
85
+ ledger: string;
86
+ };
87
+ };
88
+ };
89
+ fpCloudUrl: string;
90
+ appSlug: string;
91
+ userSlug: string;
92
+ dbName: string;
93
+ ledger: string;
94
+ tenant: string;
95
+ }, {}>;
96
+ export type ResFPCloudTokenGrant = typeof ResFPCloudTokenGrant.infer;
97
+ export declare function isResFPCloudTokenGrant(obj: unknown): obj is ResFPCloudTokenGrant;
98
+ export declare const ResFPCloudToken: import("arktype/internal/variants/object.ts").ObjectType<{
99
+ type: "vibes.diy.res-fpcloud-token";
100
+ grant: "no-grant";
101
+ } | {
102
+ type: "vibes.diy.res-fpcloud-token";
103
+ grant: "invite-editor" | "invite-viewer" | "owner" | "public" | "request-editor" | "request-viewer";
104
+ token: {
105
+ expiresInSec: number;
106
+ token: string;
107
+ claims: {
108
+ azp?: string | undefined;
109
+ iss?: string | undefined;
110
+ sub?: string | undefined;
111
+ aud?: string | string[] | undefined;
112
+ exp?: number | undefined;
113
+ nbf?: number | undefined;
114
+ iat?: number | undefined;
115
+ jti?: string | undefined;
116
+ userId: string;
117
+ email: string;
118
+ nickname?: string | undefined;
119
+ provider?: "github" | "google" | undefined;
120
+ created: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
121
+ tenants: {
122
+ id: string;
123
+ role: "admin" | "member" | "owner";
124
+ }[];
125
+ ledgers: {
126
+ id: string;
127
+ role: "admin" | "member" | "owner";
128
+ right: "read" | "write";
129
+ }[];
130
+ selected: {
131
+ appId?: string | undefined;
132
+ tenant: string;
133
+ ledger: string;
134
+ };
135
+ };
136
+ };
137
+ fpCloudUrl: string;
138
+ appSlug: string;
139
+ userSlug: string;
140
+ dbName: string;
141
+ ledger: string;
142
+ tenant: string;
143
+ }, {}>;
144
+ export type ResFPCloudToken = typeof ResFPCloudToken.infer;
145
+ export declare function isResFPCloudToken(obj: unknown): obj is ResFPCloudToken;
@@ -0,0 +1,43 @@
1
+ import { type } from "arktype";
2
+ import { dashAuthType, FPCloudClaim } from "./common.js";
3
+ export const ReqFPCloudToken = type({
4
+ type: "'vibes.diy.req-fpcloud-token'",
5
+ auth: dashAuthType,
6
+ userSlug: "string",
7
+ appSlug: "string",
8
+ dbName: "string",
9
+ });
10
+ export function isReqFPCloudToken(obj) {
11
+ return !(ReqFPCloudToken(obj) instanceof type.errors);
12
+ }
13
+ export const ResFPCloudTokenNoGrant = type({
14
+ type: "'vibes.diy.res-fpcloud-token'",
15
+ grant: "'no-grant'",
16
+ });
17
+ export function isResFPCloudTokenNoGrant(obj) {
18
+ return !(ResFPCloudTokenNoGrant(obj) instanceof type.errors);
19
+ }
20
+ export const Token = type({
21
+ expiresInSec: "number",
22
+ token: "string",
23
+ claims: FPCloudClaim,
24
+ });
25
+ export const ResFPCloudTokenGrant = type({
26
+ type: "'vibes.diy.res-fpcloud-token'",
27
+ grant: "'public' | 'owner' | 'request-editor' | 'request-viewer' | 'invite-editor' | 'invite-viewer'",
28
+ token: Token,
29
+ fpCloudUrl: "string",
30
+ appSlug: "string",
31
+ userSlug: "string",
32
+ dbName: "string",
33
+ ledger: "string",
34
+ tenant: "string",
35
+ });
36
+ export function isResFPCloudTokenGrant(obj) {
37
+ return !(ResFPCloudTokenGrant(obj) instanceof type.errors);
38
+ }
39
+ export const ResFPCloudToken = ResFPCloudTokenGrant.or(ResFPCloudTokenNoGrant);
40
+ export function isResFPCloudToken(obj) {
41
+ return !(ResFPCloudToken(obj) instanceof type.errors);
42
+ }
43
+ //# sourceMappingURL=fpcloud-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fpcloud-token.js","sourceRoot":"","sources":["../jsr/fpcloud-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;IAClC,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAIH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,OAAO,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;IACzC,IAAI,EAAE,+BAA+B;IACrC,KAAK,EAAE,YAAY;CACpB,CAAC,CAAC;AAIH,MAAM,UAAU,wBAAwB,CAAC,GAAY;IACnD,OAAO,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;IACvC,IAAI,EAAE,+BAA+B;IACrC,KAAK,EAAE,8FAA8F;IACrG,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAGH,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,OAAO,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC;AAI/E,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,OAAO,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC"}
package/index.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { Result } from "@adviser/cement";
2
2
  export * from "./types.js";
3
3
  export * from "./vibes-diy-serv-ctx.js";
4
- export * from "./msg-types.js";
4
+ export * from "./common.js";
5
+ export * from "./app.js";
6
+ export * from "./chat.js";
7
+ export * from "./settings.js";
8
+ export * from "./fpcloud-token.js";
9
+ export * from "./invite-flow.js";
10
+ export * from "./request-access.js";
5
11
  export * from "./vibes-types.js";
6
12
  export * from "./screen-shotter.js";
7
13
  export * from "./vibes-diy-api.js";
@@ -32,3 +38,14 @@ export interface S3Api {
32
38
  put(iurl: string): Promise<WritableStream<Uint8Array>>;
33
39
  rename(fromUrl: string, toUrl: string): Promise<Result<void>>;
34
40
  }
41
+ export interface StorageResult {
42
+ cid: string;
43
+ getURL: string;
44
+ mode: "created" | "existing";
45
+ created: Date;
46
+ size: number;
47
+ }
48
+ export interface VibesAssetStorage {
49
+ fetch: (url: string) => Promise<FetchResult>;
50
+ ensure: (...items: ReadableStream<Uint8Array | string>[]) => Promise<Result<StorageResult>[]>;
51
+ }
package/index.js CHANGED
@@ -1,6 +1,12 @@
1
1
  export * from "./types.js";
2
2
  export * from "./vibes-diy-serv-ctx.js";
3
- export * from "./msg-types.js";
3
+ export * from "./common.js";
4
+ export * from "./app.js";
5
+ export * from "./chat.js";
6
+ export * from "./settings.js";
7
+ export * from "./fpcloud-token.js";
8
+ export * from "./invite-flow.js";
9
+ export * from "./request-access.js";
4
10
  export * from "./vibes-types.js";
5
11
  export * from "./screen-shotter.js";
6
12
  export * from "./vibes-diy-api.js";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAQ1B,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACpC,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC;AACrC,CAAC;AAUD,MAAM,UAAU,qBAAqB,CAAC,MAAmB;IACvD,OAAO,MAAM,CAAC,IAAI,KAAK,gBAAgB,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.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