Unified · Split
| @@ -100,9 +100,11 @@ const makeFakeClient = (options?: { · 99 unmodified lines | |||
| 100 | readonly context: Record<string, string>; | 100 | readonly context: Record<string, string>; |
| 101 | }) => { | 101 | }) => { |
| 102 | if (options?.rejectNamesWithColon && name.includes(":")) { | 102 | if (options?.rejectNamesWithColon && name.includes(":")) { |
| 103 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 103 | throw new FakeInvalidRequestError(`Invalid object name "${name}"`); | 104 | throw new FakeInvalidRequestError(`Invalid object name "${name}"`); |
| 104 | } | 105 | } |
| 105 | if (objects.has(name)) { | 106 | if (objects.has(name)) { |
| 107 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 106 | throw new FakeConflictError(`Object "${name}" already exists`); | 108 | throw new FakeConflictError(`Object "${name}" already exists`); |
| 107 | } | 109 | } |
| 108 | const id = nextId(); | 110 | const id = nextId(); |
| @@ -113,15 +115,18 @@ const makeFakeClient = (options?: { · 4 unmodified lines | |||
| 113 | 115 | ||
| 114 | readObjectByName: async (name: string) => { | 116 | readObjectByName: async (name: string) => { |
| 115 | if (options?.rejectNamesWithColon && name.includes(":")) { | 117 | if (options?.rejectNamesWithColon && name.includes(":")) { |
| 118 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 116 | throw new FakeInvalidRequestError(`Invalid object name "${name}"`); | 119 | throw new FakeInvalidRequestError(`Invalid object name "${name}"`); |
| 117 | } | 120 | } |
| 118 | if ( | 121 | if ( |
| 119 | options?.rejectReadNamesLongerThan !== undefined && | 122 | options?.rejectReadNamesLongerThan !== undefined && |
| 120 | name.length > options.rejectReadNamesLongerThan | 123 | name.length > options.rejectReadNamesLongerThan |
| 121 | ) { | 124 | ) { |
| 125 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 122 | throw new FakeInvalidRequestError(`Invalid object name "${name}"`); | 126 | throw new FakeInvalidRequestError(`Invalid object name "${name}"`); |
| 123 | } | 127 | } |
| 124 | const object = objects.get(name); | 128 | const object = objects.get(name); |
| 129 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 125 | if (!object) throw new FakeNotFoundError(`Object "${name}" not found`); | 130 | if (!object) throw new FakeNotFoundError(`Object "${name}" not found`); |
| 126 | return object; | 131 | return object; |
| 127 | }, | 132 | }, |
| @@ -136,15 +141,18 @@ const makeFakeClient = (options?: { · 8 unmodified lines | |||
| 136 | readonly versionCheck?: string; | 141 | readonly versionCheck?: string; |
| 137 | }) => { | 142 | }) => { |
| 138 | const current = [...objects.values()].find((o) => o.id === id); | 143 | const current = [...objects.values()].find((o) => o.id === id); |
| 144 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 139 | if (!current) throw new FakeNotFoundError(`Object "${id}" not found`); | 145 | if (!current) throw new FakeNotFoundError(`Object "${id}" not found`); |
| 140 | if ( | 146 | if ( |
| 141 | conflictPending && | 147 | conflictPending && |
| 142 | current.name.endsWith("/secrets/conflict") | 148 | current.name.endsWith("/secrets/conflict") |
| 143 | ) { | 149 | ) { |
| 144 | conflictPending = false; | 150 | conflictPending = false; |
| 151 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 145 | throw new FakeConflictError(`Injected conflict for "${id}"`); | 152 | throw new FakeConflictError(`Injected conflict for "${id}"`); |
| 146 | } | 153 | } |
| 147 | if (versionCheck && current.metadata.versionId !== versionCheck) { | 154 | if (versionCheck && current.metadata.versionId !== versionCheck) { |
| 155 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 148 | throw new FakeConflictError(`Version mismatch for "${id}"`); | 156 | throw new FakeConflictError(`Version mismatch for "${id}"`); |
| 149 | } | 157 | } |
| 150 | const nextVersion = current.metadata.versionId.replace( | 158 | const nextVersion = current.metadata.versionId.replace( |
| @@ -166,6 +174,7 @@ const makeFakeClient = (options?: { · 15 unmodified lines | |||
| 166 | 174 | ||
| 167 | deleteObject: async ({ id }: { readonly id: string }) => { | 175 | deleteObject: async ({ id }: { readonly id: string }) => { |
| 168 | const entry = [...objects.entries()].find(([, o]) => o.id === id); | 176 | const entry = [...objects.entries()].find(([, o]) => o.id === id); |
| 177 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors | ||
| 169 | if (!entry) throw new FakeNotFoundError(`Object "${id}" not found`); | 178 | if (!entry) throw new FakeNotFoundError(`Object "${id}" not found`); |
| 170 | objects.delete(entry[0]); | 179 | objects.delete(entry[0]); |
| 171 | }, | 180 | }, |