Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+14
-3
@@ -1,3 +1,4 @@
|
||||
import { resolveIdempotencyOwnership, type IdempotencyOwnership } from "@hivegrid/foundation";
|
||||
import { getDbClient } from "./client.server.js";
|
||||
import type { IdempotencyKey, Prisma } from "../generated/prisma/client/client.js";
|
||||
|
||||
@@ -9,7 +10,7 @@ export type IdempotencyResponse = {
|
||||
headers?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type IdempotencyKeyLookup = {
|
||||
export type IdempotencyKeyLookup = IdempotencyOwnership & {
|
||||
scope?: string | null;
|
||||
key: string;
|
||||
};
|
||||
@@ -29,7 +30,8 @@ export type IdempotencyKeyReaderClient = {
|
||||
idempotencyKey: {
|
||||
findUnique(args: {
|
||||
where: {
|
||||
idempotency_key_scope_key: {
|
||||
idempotency_key_partition_scope_key: {
|
||||
partitionKey: string;
|
||||
scope: string;
|
||||
key: string;
|
||||
};
|
||||
@@ -42,6 +44,9 @@ export type IdempotencyKeyWriterClient = {
|
||||
idempotencyKey: {
|
||||
create(args: {
|
||||
data: {
|
||||
tenantId: string | null;
|
||||
partitionKey: string;
|
||||
systemOwned: boolean;
|
||||
scope: string;
|
||||
key: string;
|
||||
requestHash: string;
|
||||
@@ -74,9 +79,11 @@ export async function findIdempotencyKeyByScopeAndKey(
|
||||
input: IdempotencyKeyLookup,
|
||||
client: IdempotencyKeyReaderClient = getDbClient() as unknown as IdempotencyKeyReaderClient
|
||||
): Promise<IdempotencyKey | null> {
|
||||
const ownership = resolveIdempotencyOwnership(input);
|
||||
return client.idempotencyKey.findUnique({
|
||||
where: {
|
||||
idempotency_key_scope_key: {
|
||||
idempotency_key_partition_scope_key: {
|
||||
partitionKey: ownership.partitionKey,
|
||||
scope: normalizeIdempotencyScope(input.scope),
|
||||
key: input.key,
|
||||
},
|
||||
@@ -96,8 +103,12 @@ export async function createStoredIdempotencyResponse(
|
||||
input: CreateStoredIdempotencyResponseInput,
|
||||
client: IdempotencyKeyWriterClient = getDbClient() as unknown as IdempotencyKeyWriterClient
|
||||
): Promise<IdempotencyKey> {
|
||||
const ownership = resolveIdempotencyOwnership(input);
|
||||
return client.idempotencyKey.create({
|
||||
data: {
|
||||
tenantId: ownership.tenantId,
|
||||
partitionKey: ownership.partitionKey,
|
||||
systemOwned: ownership.systemOwned,
|
||||
scope: normalizeIdempotencyScope(input.scope),
|
||||
key: input.key,
|
||||
requestHash: input.requestHash,
|
||||
|
||||
Reference in new issue
Block a user