@nxgt/janus 0.17.1 → 0.17.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.
@@ -2,7 +2,7 @@ import {
2
2
  JanusError2,
3
3
  InvalidCursorError2,
4
4
  StoreFailure2
5
- } from "./index-hnwggyxs.js";
5
+ } from "./index-ztng6018.js";
6
6
 
7
7
  // src/pagination/cursor-page.ts
8
8
  var DEFAULT_PAGE_SIZE2 = 20;
@@ -72,4 +72,4 @@ var UNSTORABLE = "holds a NUL character or a lone surrogate, which no store can
72
72
  export { guardStore, guardRelations, isStorable, UNSTORABLE, DEFAULT_PAGE_SIZE2, MAX_PAGE_SIZE2, pageLimit2, invalidCursor2 };
73
73
 
74
74
  //# debugId=7AD3830DC22148E664756E2164756E21
75
- //# sourceMappingURL=index-kj3st57z.js.map
75
+ //# sourceMappingURL=index-6fxq0kzf.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  StoreConflict2,
3
3
  NotFoundError2
4
- } from "./index-hnwggyxs.js";
4
+ } from "./index-ztng6018.js";
5
5
 
6
6
  // src/ids/id.ts
7
7
  var HEX = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
@@ -307,4 +307,4 @@ function createMemoryStores2() {
307
307
  export { mintId2, isId2, mintedAt2, createMemoryStores2 };
308
308
 
309
309
  //# debugId=0777A8A648CFB0FA64756E2164756E21
310
- //# sourceMappingURL=index-baazjyvc.js.map
310
+ //# sourceMappingURL=index-7xe5x3eg.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isSubjectSet2,
3
3
  formatTuple2
4
- } from "./index-hnwggyxs.js";
4
+ } from "./index-ztng6018.js";
5
5
 
6
6
  // src/permissions/port/memory.ts
7
7
  function createMemoryRelations2() {
@@ -77,4 +77,4 @@ function copyTuple(tuple) {
77
77
  export { createMemoryRelations2 };
78
78
 
79
79
  //# debugId=0BA3AA406E650E8464756E2164756E21
80
- //# sourceMappingURL=index-6c9fbtv2.js.map
80
+ //# sourceMappingURL=index-k136102s.js.map
@@ -1,9 +1,24 @@
1
1
  // src/errors/janus-error/base.ts
2
2
  class JanusError2 extends Error {
3
+ name = "JanusError";
4
+ code = "STORE_FAILED";
5
+ userId;
6
+ userType;
7
+ login;
8
+ reason;
9
+ hashPrefix;
10
+ expectedVersion;
11
+ actualVersion;
12
+ issues;
13
+ minLength;
14
+ operation;
15
+ slot;
16
+ permission;
17
+ maxDepth;
18
+ attemptsLeft;
19
+ retryAfter;
3
20
  constructor(message, options) {
4
21
  super(message, { cause: options?.cause });
5
- this.name = "JanusError";
6
- this.code = "STORE_FAILED";
7
22
  this.userId = options?.userId;
8
23
  this.userType = options?.userType;
9
24
  this.login = options?.login;
@@ -24,75 +39,60 @@ class JanusError2 extends Error {
24
39
 
25
40
  // src/errors/janus-error/refusals.ts
26
41
  class UserInvalidError2 extends JanusError2 {
27
- constructor() {
28
- super(...arguments);
29
- this.name = "UserInvalidError";
30
- this.code = "USER_INVALID";
31
- }
42
+ name = "UserInvalidError";
43
+ code = "USER_INVALID";
32
44
  }
33
45
 
34
46
  class CredentialError2 extends JanusError2 {
47
+ name = "CredentialError";
48
+ code;
35
49
  constructor(code, message, options) {
36
50
  super(message, options);
37
- this.name = "CredentialError";
38
51
  this.code = code;
39
52
  }
40
53
  }
41
54
 
42
55
  class UserInactiveError2 extends JanusError2 {
43
- constructor() {
44
- super(...arguments);
45
- this.name = "UserInactiveError";
46
- this.code = "USER_INACTIVE";
47
- }
56
+ name = "UserInactiveError";
57
+ code = "USER_INACTIVE";
48
58
  }
49
59
 
50
60
  class TokenError2 extends JanusError2 {
61
+ name = "TokenError";
62
+ code;
51
63
  constructor(code, message, options) {
52
64
  super(message, options);
53
- this.name = "TokenError";
54
65
  this.code = code;
55
66
  }
56
67
  }
57
68
 
58
69
  class SecondFactorError2 extends JanusError2 {
70
+ name = "SecondFactorError";
71
+ code;
59
72
  constructor(code, message, options) {
60
73
  super(message, options);
61
- this.name = "SecondFactorError";
62
74
  this.code = code;
63
75
  }
64
76
  }
65
77
 
66
78
  class StepUpRequiredError2 extends JanusError2 {
67
- constructor() {
68
- super(...arguments);
69
- this.name = "StepUpRequiredError";
70
- this.code = "STEP_UP_REQUIRED";
71
- }
79
+ name = "StepUpRequiredError";
80
+ code = "STEP_UP_REQUIRED";
72
81
  }
73
82
 
74
83
  class InvalidCursorError2 extends JanusError2 {
75
- constructor() {
76
- super(...arguments);
77
- this.name = "InvalidCursorError";
78
- this.code = "INVALID_CURSOR";
79
- }
84
+ name = "InvalidCursorError";
85
+ code = "INVALID_CURSOR";
80
86
  }
81
87
 
82
88
  class UnsupportedError2 extends JanusError2 {
83
- constructor() {
84
- super(...arguments);
85
- this.name = "UnsupportedError";
86
- this.code = "UNSUPPORTED";
87
- }
89
+ name = "UnsupportedError";
90
+ code = "UNSUPPORTED";
88
91
  }
89
92
 
90
93
  class PermissionDepthError2 extends JanusError2 {
91
- constructor() {
92
- super(...arguments);
93
- this.name = "PermissionDepthError";
94
- this.code = "PERMISSION_DEPTH";
95
- }
94
+ name = "PermissionDepthError";
95
+ code = "PERMISSION_DEPTH";
96
96
  }
97
97
 
98
98
  // src/errors/janus-error/status.ts
@@ -131,28 +131,24 @@ function statusOf2(code) {
131
131
 
132
132
  // src/errors/janus-error/store.ts
133
133
  class StoreFailure2 extends JanusError2 {
134
- constructor() {
135
- super(...arguments);
136
- this.name = "StoreFailure";
137
- this.code = "STORE_FAILED";
138
- }
134
+ name = "StoreFailure";
135
+ code = "STORE_FAILED";
139
136
  }
140
137
 
141
138
  class StoreConflict2 extends JanusError2 {
139
+ name = "StoreConflict";
140
+ code;
141
+ on;
142
142
  constructor(on, message, options) {
143
143
  super(message, options);
144
- this.name = "StoreConflict";
145
144
  this.on = on;
146
145
  this.code = on === "login" ? "LOGIN_TAKEN" : "VERSION_CONFLICT";
147
146
  }
148
147
  }
149
148
 
150
149
  class NotFoundError2 extends JanusError2 {
151
- constructor() {
152
- super(...arguments);
153
- this.name = "NotFoundError";
154
- this.code = "NOT_FOUND";
155
- }
150
+ name = "NotFoundError";
151
+ code = "NOT_FOUND";
156
152
  }
157
153
  // src/subjects/subject.ts
158
154
  function isSubjectSet2(subject) {
@@ -214,5 +210,5 @@ function parseSubject2(text) {
214
210
 
215
211
  export { JanusError2, UserInvalidError2, CredentialError2, UserInactiveError2, TokenError2, SecondFactorError2, StepUpRequiredError2, InvalidCursorError2, UnsupportedError2, PermissionDepthError2, statusOf2, StoreFailure2, StoreConflict2, NotFoundError2, isSubjectSet2, subjectOf2, setOf2, isSetOf2, formatEntity2, formatSubject2, formatTuple2, parseTuple2, parseSubject2 };
216
212
 
217
- //# debugId=241B9AAD2965E64964756E2164756E21
218
- //# sourceMappingURL=index-hnwggyxs.js.map
213
+ //# debugId=4E81B0D2228C154C64756E2164756E21
214
+ //# sourceMappingURL=index-ztng6018.js.map
@@ -9,7 +9,7 @@
9
9
  "/**\n * The id every decision in this package hangs on: a user's `id`, as `janus()`\n * mints it.\n *\n * In Ory, the equality between a Kratos identity id and Keto's `subject_id` is\n * a comment and a convention, restated in three repositories and enforced\n * nowhere. Here a user **is** a subject — see {@link subjectOf} — and that\n * shared vocabulary is the whole reason users and permissions are one package\n * rather than two: two packages would make this contract implicit, and an\n * implicit contract between independently versioned packages breaks silently.\n *\n * Opaque: compared with `===`, carried in a URL, logged, never parsed.\n */\nexport type SubjectId = string;\n\n/**\n * Something a permission is about or held by — a user, a record, a team — by\n * its type and its id.\n *\n * **Typed, unlike Keto's subjects.** One application has patients and staff,\n * and an object can hold a relation too (a record's team), so an id alone does\n * not say who. `type` is a user type of `janus()` or an object type of the\n * permission model, and the same word as a user's own `type`.\n */\nexport interface Entity {\n\treadonly type: string;\n\treadonly id: string;\n}\n\n/**\n * Everyone who holds `relation` on an entity — `team:t1#member` — which is how\n * a permission is inherited rather than granted.\n *\n * A tuple whose subject is a subject set lets a whole group be given access\n * with one write: granting a record's `viewer` to `team:t1#member` means every\n * member of that team can view it, and no member holds a tuple on the record.\n */\nexport interface SubjectSet extends Entity {\n\treadonly relation: string;\n}\n\n/**\n * Who a tuple is about: one entity, or everyone who holds a relation on one.\n * {@link isSubjectSet} tells them apart.\n */\nexport type Subject = Entity | SubjectSet;\n\n/**\n * A relation tuple: `subject` holds `relation` on `object`.\n *\n * `relation` is Zanzibar's word, and a tuple is Zanzibar's unit. What is not\n * carried over is Keto's `namespace`/`object` pair: here the object is an\n * {@link Entity}, with the `type` and `id` a user already has.\n */\nexport interface RelationTuple {\n\treadonly object: Entity;\n\treadonly relation: string;\n\treadonly subject: Subject;\n}\n\n/**\n * Whether this subject is a set rather than one entity. Narrows.\n *\n * It reads the shape, so pass a user through {@link subjectOf} first: a user\n * whose fields include a string `relation` would otherwise read as a set.\n */\nexport function isSubjectSet(subject: Subject): subject is SubjectSet {\n\treturn typeof (subject as { relation?: unknown }).relation === 'string';\n}\n\n/**\n * The subject a user is: their `type` and `id`, and nothing else.\n *\n * One line, and the entire join between the two sides of the package. It\n * takes the narrowest shape it reads, so the permissions side never has to\n * know what a user is, and it copies those two fields so none of the user's\n * own fields ever reaches a tuple.\n */\nexport function subjectOf(user: {\n\treadonly type: string;\n\treadonly id: SubjectId;\n}): Entity {\n\treturn { type: user.type, id: user.id };\n}\n\n/**\n * The mark `setOf()` puts on a set: a symbol property, so it survives a spread\n * and `Object.assign`, and no value read from a database or from JSON can\n * carry it. Registered with `Symbol.for`, so two copies of this module — two\n * bundles, two entry points — still agree on it.\n */\nconst SET_OF: unique symbol = Symbol.for('@nxgt/janus/setOf');\n\n/**\n * A subject set `setOf()` made: everyone who holds `relation` on `type:id`.\n *\n * Marked, because a user is passed to `can()` and `grant()` as it is, fields\n * flat on it: a user whose fields include `relation` must stay that user, and\n * never read as the set of whoever holds that relation on them. For an object\n * type, `{ type, id, relation }` is a set as written; for a user type — one\n * the model also declares as an object type — only `setOf()` makes one.\n *\n * A spread keeps the mark. `JSON.stringify` and `structuredClone` drop it:\n * through either, a set comes back as a user — call `setOf()` again, or\n * `parseSubject()` on its notation.\n */\nexport type SetOf<\n\tType extends string = string,\n\tRelation extends string = string,\n> = SubjectSet & {\n\treadonly type: Type;\n\treadonly relation: Relation;\n\treadonly [SET_OF]: true;\n};\n\n/**\n * A user or an object, never a set `setOf()` made: where a relation admits\n * `staff` but not `staff#managers`, a set passed there is refused at compile\n * time as it is at run time.\n */\nexport type NotASet = { readonly [SET_OF]?: never };\n\n/**\n * Everyone who holds `relation` on this user or object — `staff:s1#managers`.\n *\n * ```ts\n * await access.grant(record, 'viewers', setOf(ada, 'managers'));\n * ```\n *\n * Copies `type` and `id` only, like {@link subjectOf}: none of a user's own\n * fields reaches a tuple.\n */\nexport function setOf<const Type extends string, const Relation extends string>(\n\tentity: { readonly type: Type; readonly id: SubjectId },\n\trelation: Relation,\n): SetOf<Type, Relation> {\n\tif (\n\t\ttypeof entity !== 'object' ||\n\t\tentity === null ||\n\t\ttypeof entity.type !== 'string' ||\n\t\ttypeof entity.id !== 'string'\n\t) {\n\t\tthrow new TypeError('setOf: pass a user or { type, id }, then a relation');\n\t}\n\tif (typeof relation !== 'string' || relation === '') {\n\t\tthrow new TypeError('setOf: the relation must be a non-empty string');\n\t}\n\treturn Object.freeze({\n\t\ttype: entity.type,\n\t\tid: entity.id,\n\t\trelation,\n\t\t[SET_OF]: true as const,\n\t});\n}\n\n/**\n * Whether `setOf()` made this value, or a spread of one — what `can()` and\n * `grant()` read to tell a set on a user type from a user.\n */\nexport function isSetOf(value: unknown): value is SetOf {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t(value as { readonly [SET_OF]?: unknown })[SET_OF] === true\n\t);\n}\n",
10
10
  "import {\n\ttype Entity,\n\tisSubjectSet,\n\ttype RelationTuple,\n\ttype SetOf,\n\ttype Subject,\n\tsetOf,\n} from './subject';\n\n/**\n * Zanzibar's notation, with typed subjects:\n *\n * ```\n * record:r1#viewer@staff:u1\n * record:r1#viewer@team:t1#member\n * ```\n *\n * It exists for **messages, logs and documentation**, not as a wire format:\n * nothing in this package parses a tuple off the network, and a tuple that\n * crosses a boundary crosses it as an object. Keeping the notation is worth it\n * because every piece of Zanzibar writing uses it, so an error message in it is\n * an error message a reader has already learned to read.\n *\n * A type holds no `:`, and no part holds `@`, `#` or a parenthesis, so a\n * subject set needs no parentheses: after the `@`, a `#` can only begin its\n * relation. {@link parseTuple} refuses a string where that would not hold,\n * rather than reading it two ways.\n */\nexport function formatEntity(entity: Entity): string {\n\treturn `${entity.type}:${entity.id}`;\n}\n\n/** One subject: `staff:u1`, or `team:t1#member`. */\nexport function formatSubject(subject: Subject): string {\n\treturn isSubjectSet(subject)\n\t\t? `${formatEntity(subject)}#${subject.relation}`\n\t\t: formatEntity(subject);\n}\n\n/** One relation tuple, in the notation above. */\nexport function formatTuple(tuple: RelationTuple): string {\n\treturn `${formatEntity(tuple.object)}#${tuple.relation}@${formatSubject(tuple.subject)}`;\n}\n\nconst TYPE = '([^:@#()]+)';\nconst ID = '([^@#()]+)';\nconst RELATION = '([^:@#()]+)';\n\nconst TUPLE = new RegExp(`^${TYPE}:${ID}#${RELATION}@(.+)$`);\nconst SUBJECT = new RegExp(`^${TYPE}:${ID}(?:#${RELATION})?$`);\n\n/**\n * Reads a tuple back. Refuses, with a `TypeError`, a string that is not one —\n * a permission question built from a malformed string is a question whose\n * answer means nothing, and no request is behind it: the string came from a\n * developer's own code.\n */\nexport function parseTuple(text: string): RelationTuple {\n\tconst match = TUPLE.exec(text);\n\n\tif (!match) {\n\t\tthrow new TypeError(\n\t\t\t`parseTuple: \"${text}\" is not a relation tuple; expected type:id#relation@subject`,\n\t\t);\n\t}\n\n\tconst [, type, id, relation, subject] = match as unknown as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t];\n\n\treturn { object: { type, id }, relation, subject: parseSubject(subject) };\n}\n\n/**\n * Reads one subject back: `staff:u1`, or `team:t1#member`. A set is answered\n * as `setOf()` makes it, so `can()` and `grant()` read it as the set it names\n * on a user type too.\n */\nexport function parseSubject(text: string): Entity | SetOf {\n\tconst match = SUBJECT.exec(text);\n\n\tif (!match) {\n\t\tthrow new TypeError(\n\t\t\t`parseSubject: \"${text}\" is not a subject; expected type:id, or type:id#relation for a subject set`,\n\t\t);\n\t}\n\n\tconst [, type, id, relation] = match as unknown as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring | undefined,\n\t];\n\n\treturn relation === undefined ? { type, id } : setOf({ type, id }, relation);\n}\n"
11
11
  ],
12
- "mappings": ";AAmBO,MAAM,oBAAmB,MAAM;AAAA,EAmBrC,WAAW,CAAC,SAAiB,SAA6B;AAAA,IACzD,MAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AAAA,IAnBhC,YAAO;AAAA,IACP,YAAuB;AAAA,IAmB/B,KAAK,SAAS,SAAS;AAAA,IACvB,KAAK,WAAW,SAAS;AAAA,IACzB,KAAK,QAAQ,SAAS;AAAA,IACtB,KAAK,SAAS,SAAS;AAAA,IACvB,KAAK,aAAa,SAAS;AAAA,IAC3B,KAAK,kBAAkB,SAAS;AAAA,IAChC,KAAK,gBAAgB,SAAS;AAAA,IAC9B,KAAK,SAAS,SAAS;AAAA,IACvB,KAAK,YAAY,SAAS;AAAA,IAC1B,KAAK,YAAY,SAAS;AAAA,IAC1B,KAAK,OAAO,SAAS;AAAA,IACrB,KAAK,aAAa,SAAS;AAAA,IAC3B,KAAK,WAAW,SAAS;AAAA,IACzB,KAAK,eAAe,SAAS;AAAA,IAC7B,KAAK,aAAa,SAAS;AAAA;AAE7B;;;ACnDO,MAAM,0BAAyB,YAAW;AAAA;AAAA;AAAA,IACvC,YAAO;AAAA,IACE,YAAO;AAAA;AAC1B;AAAA;AAGO,MAAM,yBAAwB,YAAW;AAAA,EAI/C,WAAW,CACV,MAIA,SACA,SACC;AAAA,IACD,MAAM,SAAS,OAAO;AAAA,IAXd,YAAO;AAAA,IAYf,KAAK,OAAO;AAAA;AAEd;AAAA;AAGO,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,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,UAAU,SAAS,cAAa,OAAO,EAAE;AAAA;AAQlE,SAAS,aAAY,CAAC,MAA8B;AAAA,EAC1D,MAAM,QAAQ,QAAQ,KAAK,IAAI;AAAA,EAE/B,IAAI,CAAC,OAAO;AAAA,IACX,MAAM,IAAI,UACT,kBAAkB,iFACnB;AAAA,EACD;AAAA,EAEA,SAAS,MAAM,IAAI,YAAY;AAAA,EAO/B,OAAO,aAAa,YAAY,EAAE,MAAM,GAAG,IAAI,OAAM,EAAE,MAAM,GAAG,GAAG,QAAQ;AAAA;",
13
+ "debugId": "4E81B0D2228C154C64756E2164756E21",
14
14
  "names": []
15
15
  }
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  mintId2,
3
3
  createMemoryStores2
4
- } from "../chunks/index-baazjyvc.js";
4
+ } from "../chunks/index-7xe5x3eg.js";
5
5
  import {
6
6
  JanusError2,
7
7
  StoreFailure2,
8
8
  StoreConflict2,
9
9
  NotFoundError2,
10
10
  formatSubject2
11
- } from "../chunks/index-hnwggyxs.js";
11
+ } from "../chunks/index-ztng6018.js";
12
12
  import {
13
13
  createMemoryRelations2
14
- } from "../chunks/index-6c9fbtv2.js";
14
+ } from "../chunks/index-k136102s.js";
15
15
 
16
16
  // src/conformance/assert.ts
17
17
  function equal(actual, expected, what) {
package/dist/index.js CHANGED
@@ -7,13 +7,13 @@ import {
7
7
  MAX_PAGE_SIZE2,
8
8
  pageLimit2,
9
9
  invalidCursor2
10
- } from "./chunks/index-kj3st57z.js";
10
+ } from "./chunks/index-6fxq0kzf.js";
11
11
  import {
12
12
  mintId2,
13
13
  isId2,
14
14
  mintedAt2,
15
15
  createMemoryStores2
16
- } from "./chunks/index-baazjyvc.js";
16
+ } from "./chunks/index-7xe5x3eg.js";
17
17
  import {
18
18
  JanusError2,
19
19
  UserInvalidError2,
@@ -38,7 +38,7 @@ import {
38
38
  formatTuple2,
39
39
  parseTuple2,
40
40
  parseSubject2
41
- } from "./chunks/index-hnwggyxs.js";
41
+ } from "./chunks/index-ztng6018.js";
42
42
 
43
43
  // src/auth/hashers.ts
44
44
  import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
@@ -726,7 +726,7 @@ function assertStores(stores, where) {
726
726
  }
727
727
  }
728
728
  const sessions = stores.sessions;
729
- const collect = sessions.deleteExpiredSessions;
729
+ const collect = sessions["deleteExpiredSessions"];
730
730
  if (collect !== undefined && typeof collect !== "function") {
731
731
  throw new TypeError(`${where}: store.sessions.deleteExpiredSessions must be a function or absent`);
732
732
  }
@@ -2136,7 +2136,7 @@ async function signIn(context, type, finish, input, call) {
2136
2136
  const rule = passwordRule(type, where);
2137
2137
  const hasher = requireHasher(context, where);
2138
2138
  const login = input?.[rule.login];
2139
- const password = input?.password;
2139
+ const password = input?.["password"];
2140
2140
  const normalized = typeof login === "string" ? rule.normalize(login) : null;
2141
2141
  if (normalized !== null) {
2142
2142
  await countSignInAttempt(context, type, normalized, where);
@@ -2175,7 +2175,7 @@ function passwordFlows(context, type, at, finish) {
2175
2175
  const where = at("signUp");
2176
2176
  const device = deviceHint(context, options, where);
2177
2177
  passwordRule(type, where);
2178
- if (input?.password === undefined) {
2178
+ if (input?.["password"] === undefined) {
2179
2179
  checkPassword(type, undefined, where);
2180
2180
  }
2181
2181
  const record = await insert(context, type, input, where);
@@ -2346,7 +2346,7 @@ function janus(config) {
2346
2346
  type.name,
2347
2347
  typeApi(context, type)
2348
2348
  ]));
2349
- const surface = resolved.single ? { ...shared, ...types.user } : { ...shared, ...types };
2349
+ const surface = resolved.single ? { ...shared, ...types["user"] } : { ...shared, ...types };
2350
2350
  return surface;
2351
2351
  }
2352
2352
  // src/auth/sessions/fresh.ts
@@ -2399,5 +2399,5 @@ export {
2399
2399
  systemClock
2400
2400
  };
2401
2401
 
2402
- //# debugId=735288C311F315A564756E2164756E21
2402
+ //# debugId=AA27B9CD21C48F3A64756E2164756E21
2403
2403
  //# sourceMappingURL=index.js.map