@sagebox-be/prisma-inventory 0.0.1
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/README.md +11 -0
- package/package.json +24 -0
- package/prisma/client/client.d.ts +1 -0
- package/prisma/client/client.js +4 -0
- package/prisma/client/default.d.ts +1 -0
- package/prisma/client/default.js +4 -0
- package/prisma/client/edge.d.ts +1 -0
- package/prisma/client/edge.js +240 -0
- package/prisma/client/index-browser.js +223 -0
- package/prisma/client/index.d.ts +8124 -0
- package/prisma/client/index.js +265 -0
- package/prisma/client/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/prisma/client/libquery_engine-linux-musl-openssl-3.0.x.so.node +0 -0
- package/prisma/client/package.json +183 -0
- package/prisma/client/query_engine_bg.js +2 -0
- package/prisma/client/query_engine_bg.wasm +0 -0
- package/prisma/client/runtime/edge-esm.js +34 -0
- package/prisma/client/runtime/edge.js +34 -0
- package/prisma/client/runtime/index-browser.d.ts +370 -0
- package/prisma/client/runtime/index-browser.js +16 -0
- package/prisma/client/runtime/library.d.ts +3977 -0
- package/prisma/client/runtime/library.js +146 -0
- package/prisma/client/runtime/react-native.js +83 -0
- package/prisma/client/runtime/wasm-compiler-edge.js +84 -0
- package/prisma/client/runtime/wasm-engine-edge.js +36 -0
- package/prisma/client/schema.prisma +111 -0
- package/prisma/client/wasm-edge-light-loader.mjs +4 -0
- package/prisma/client/wasm-worker-loader.mjs +4 -0
- package/prisma/client/wasm.d.ts +1 -0
- package/prisma/client/wasm.js +247 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
|
|
2
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
PrismaClientKnownRequestError,
|
|
9
|
+
PrismaClientUnknownRequestError,
|
|
10
|
+
PrismaClientRustPanicError,
|
|
11
|
+
PrismaClientInitializationError,
|
|
12
|
+
PrismaClientValidationError,
|
|
13
|
+
getPrismaClient,
|
|
14
|
+
sqltag,
|
|
15
|
+
empty,
|
|
16
|
+
join,
|
|
17
|
+
raw,
|
|
18
|
+
skip,
|
|
19
|
+
Decimal,
|
|
20
|
+
Debug,
|
|
21
|
+
objectEnumValues,
|
|
22
|
+
makeStrictEnum,
|
|
23
|
+
Extensions,
|
|
24
|
+
warnOnce,
|
|
25
|
+
defineDmmfProperty,
|
|
26
|
+
Public,
|
|
27
|
+
getRuntime,
|
|
28
|
+
createParam,
|
|
29
|
+
} = require('./runtime/wasm-engine-edge.js')
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const Prisma = {}
|
|
33
|
+
|
|
34
|
+
exports.Prisma = Prisma
|
|
35
|
+
exports.$Enums = {}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Prisma Client JS version: 6.17.1
|
|
39
|
+
* Query Engine version: 272a37d34178c2894197e17273bf937f25acdeac
|
|
40
|
+
*/
|
|
41
|
+
Prisma.prismaVersion = {
|
|
42
|
+
client: "6.17.1",
|
|
43
|
+
engine: "272a37d34178c2894197e17273bf937f25acdeac"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Prisma.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
|
|
47
|
+
Prisma.PrismaClientUnknownRequestError = PrismaClientUnknownRequestError
|
|
48
|
+
Prisma.PrismaClientRustPanicError = PrismaClientRustPanicError
|
|
49
|
+
Prisma.PrismaClientInitializationError = PrismaClientInitializationError
|
|
50
|
+
Prisma.PrismaClientValidationError = PrismaClientValidationError
|
|
51
|
+
Prisma.Decimal = Decimal
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Re-export of sql-template-tag
|
|
55
|
+
*/
|
|
56
|
+
Prisma.sql = sqltag
|
|
57
|
+
Prisma.empty = empty
|
|
58
|
+
Prisma.join = join
|
|
59
|
+
Prisma.raw = raw
|
|
60
|
+
Prisma.validator = Public.validator
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Extensions
|
|
64
|
+
*/
|
|
65
|
+
Prisma.getExtensionContext = Extensions.getExtensionContext
|
|
66
|
+
Prisma.defineExtension = Extensions.defineExtension
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Shorthand utilities for JSON filtering
|
|
70
|
+
*/
|
|
71
|
+
Prisma.DbNull = objectEnumValues.instances.DbNull
|
|
72
|
+
Prisma.JsonNull = objectEnumValues.instances.JsonNull
|
|
73
|
+
Prisma.AnyNull = objectEnumValues.instances.AnyNull
|
|
74
|
+
|
|
75
|
+
Prisma.NullTypes = {
|
|
76
|
+
DbNull: objectEnumValues.classes.DbNull,
|
|
77
|
+
JsonNull: objectEnumValues.classes.JsonNull,
|
|
78
|
+
AnyNull: objectEnumValues.classes.AnyNull
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Enums
|
|
87
|
+
*/
|
|
88
|
+
exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
|
|
89
|
+
ReadUncommitted: 'ReadUncommitted',
|
|
90
|
+
ReadCommitted: 'ReadCommitted',
|
|
91
|
+
RepeatableRead: 'RepeatableRead',
|
|
92
|
+
Serializable: 'Serializable'
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
exports.Prisma.WarehouseScalarFieldEnum = {
|
|
96
|
+
id: 'id',
|
|
97
|
+
code: 'code',
|
|
98
|
+
name: 'name',
|
|
99
|
+
province: 'province',
|
|
100
|
+
district: 'district',
|
|
101
|
+
ward: 'ward',
|
|
102
|
+
address: 'address',
|
|
103
|
+
isActive: 'isActive',
|
|
104
|
+
createdAt: 'createdAt',
|
|
105
|
+
updatedAt: 'updatedAt'
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports.Prisma.InventoryItemScalarFieldEnum = {
|
|
109
|
+
id: 'id',
|
|
110
|
+
warehouseId: 'warehouseId',
|
|
111
|
+
sku: 'sku',
|
|
112
|
+
quantityOnHand: 'quantityOnHand',
|
|
113
|
+
quantityReserved: 'quantityReserved',
|
|
114
|
+
version: 'version',
|
|
115
|
+
createdAt: 'createdAt',
|
|
116
|
+
updatedAt: 'updatedAt'
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.Prisma.InventoryReservationScalarFieldEnum = {
|
|
120
|
+
id: 'id',
|
|
121
|
+
warehouseId: 'warehouseId',
|
|
122
|
+
orderId: 'orderId',
|
|
123
|
+
sku: 'sku',
|
|
124
|
+
quantity: 'quantity',
|
|
125
|
+
status: 'status',
|
|
126
|
+
expiredAt: 'expiredAt',
|
|
127
|
+
createdAt: 'createdAt',
|
|
128
|
+
updatedAt: 'updatedAt'
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
exports.Prisma.InventoryLedgerScalarFieldEnum = {
|
|
132
|
+
id: 'id',
|
|
133
|
+
warehouseId: 'warehouseId',
|
|
134
|
+
sku: 'sku',
|
|
135
|
+
type: 'type',
|
|
136
|
+
amount: 'amount',
|
|
137
|
+
balanceAfter: 'balanceAfter',
|
|
138
|
+
referenceId: 'referenceId',
|
|
139
|
+
note: 'note',
|
|
140
|
+
createdAt: 'createdAt'
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
exports.Prisma.SortOrder = {
|
|
144
|
+
asc: 'asc',
|
|
145
|
+
desc: 'desc'
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
exports.Prisma.QueryMode = {
|
|
149
|
+
default: 'default',
|
|
150
|
+
insensitive: 'insensitive'
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
exports.Prisma.NullsOrder = {
|
|
154
|
+
first: 'first',
|
|
155
|
+
last: 'last'
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
exports.Prisma.ModelName = {
|
|
160
|
+
Warehouse: 'Warehouse',
|
|
161
|
+
InventoryItem: 'InventoryItem',
|
|
162
|
+
InventoryReservation: 'InventoryReservation',
|
|
163
|
+
InventoryLedger: 'InventoryLedger'
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Create the Client
|
|
167
|
+
*/
|
|
168
|
+
const config = {
|
|
169
|
+
"generator": {
|
|
170
|
+
"name": "client",
|
|
171
|
+
"provider": {
|
|
172
|
+
"fromEnvVar": null,
|
|
173
|
+
"value": "prisma-client-js"
|
|
174
|
+
},
|
|
175
|
+
"output": {
|
|
176
|
+
"value": "/Users/oreka/Downloads/sagebox/sagebox-be/libs/prisma-inventory/prisma/client",
|
|
177
|
+
"fromEnvVar": null
|
|
178
|
+
},
|
|
179
|
+
"config": {
|
|
180
|
+
"engineType": "library"
|
|
181
|
+
},
|
|
182
|
+
"binaryTargets": [
|
|
183
|
+
{
|
|
184
|
+
"fromEnvVar": null,
|
|
185
|
+
"value": "darwin-arm64",
|
|
186
|
+
"native": true
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"fromEnvVar": null,
|
|
190
|
+
"value": "linux-musl-openssl-3.0.x"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"previewFeatures": [],
|
|
194
|
+
"sourceFilePath": "/Users/oreka/Downloads/sagebox/sagebox-be/libs/prisma-inventory/prisma/schema.prisma",
|
|
195
|
+
"isCustomOutput": true
|
|
196
|
+
},
|
|
197
|
+
"relativeEnvPaths": {
|
|
198
|
+
"rootEnvPath": null
|
|
199
|
+
},
|
|
200
|
+
"relativePath": "..",
|
|
201
|
+
"clientVersion": "6.17.1",
|
|
202
|
+
"engineVersion": "272a37d34178c2894197e17273bf937f25acdeac",
|
|
203
|
+
"datasourceNames": [
|
|
204
|
+
"db"
|
|
205
|
+
],
|
|
206
|
+
"activeProvider": "postgresql",
|
|
207
|
+
"postinstall": false,
|
|
208
|
+
"inlineDatasources": {
|
|
209
|
+
"db": {
|
|
210
|
+
"url": {
|
|
211
|
+
"fromEnvVar": "DATABASE_INVENTORY_URL",
|
|
212
|
+
"value": null
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n output = env(\"PRISMA_CLIENT_INVENTORY_OUTPUT\")\n binaryTargets = [\"native\", \"linux-musl-openssl-3.0.x\"]\n}\n\ngenerator json {\n provider = \"prisma-json-types-generator\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_INVENTORY_URL\")\n}\n\n// ============================================================================\n// MODELS\n// ============================================================================\n\n/// Represents a physical warehouse location\nmodel Warehouse {\n id String @id @default(uuid()) @db.Uuid\n code String @unique(map: \"warehouse_code\") @db.VarChar(50)\n name String @db.VarChar(255)\n province String? @db.VarChar(100)\n district String? @db.VarChar(100)\n ward String? @db.VarChar(100)\n address String? @db.VarChar(500)\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n inventoryItems InventoryItem[]\n reservations InventoryReservation[]\n ledgers InventoryLedger[]\n\n @@index([code], map: \"warehouses_code\")\n @@index([isActive], map: \"warehouses_is_active\")\n @@map(\"warehouses\")\n}\n\n/// Represents the stock snapshot for a SKU in a specific warehouse\n/// Uses Optimistic Locking via the `version` field to handle concurrency\nmodel InventoryItem {\n id String @id @default(uuid()) @db.Uuid\n warehouseId String @db.Uuid\n sku String @db.VarChar(100)\n quantityOnHand Int @default(0)\n quantityReserved Int @default(0)\n version Int @default(1) // Optimistic Locking version field\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)\n\n @@unique([warehouseId, sku], map: \"inventory_items_warehouse_sku\")\n @@index([sku], map: \"inventory_items_sku\")\n @@index([warehouseId], map: \"inventory_items_warehouse_id\")\n @@map(\"inventory_items\")\n}\n\n/// Temporary hold for the Two-Phase Reservation (Saga pattern)\n/// Ensures idempotency via unique constraint on [orderId, sku]\nmodel InventoryReservation {\n id String @id @default(uuid()) @db.Uuid\n warehouseId String @db.Uuid\n orderId String @db.VarChar(100)\n sku String @db.VarChar(100)\n quantity Int\n status String @default(\"Pending\") @db.VarChar(20) // Pending, Confirmed, Cancelled, Expired\n expiredAt DateTime\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)\n\n @@unique([orderId, sku], map: \"reservations_order_sku\")\n @@index([orderId], map: \"reservations_order_id\")\n @@index([sku], map: \"reservations_sku\")\n @@index([status], map: \"reservations_status\")\n @@index([expiredAt], map: \"reservations_expired_at\")\n @@index([warehouseId], map: \"reservations_warehouse_id\")\n @@map(\"inventory_reservations\")\n}\n\n/// Immutable audit log for all stock movements\n/// Records every change to inventory with full traceability\nmodel InventoryLedger {\n id String @id @default(uuid()) @db.Uuid\n warehouseId String @db.Uuid\n sku String @db.VarChar(100)\n type String @db.VarChar(20) // Import, Sale, Return, Adjustment, Transfer\n amount Int // Can be negative (e.g., for sales)\n balanceAfter Int\n referenceId String @db.VarChar(100) // e.g., order ID, PO ID\n note String? @db.VarChar(500)\n createdAt DateTime @default(now())\n\n // Relations\n warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)\n\n @@index([sku], map: \"ledgers_sku\")\n @@index([referenceId], map: \"ledgers_reference_id\")\n @@index([type], map: \"ledgers_type\")\n @@index([warehouseId], map: \"ledgers_warehouse_id\")\n @@index([createdAt], map: \"ledgers_created_at\")\n @@map(\"inventory_ledgers\")\n}\n",
|
|
217
|
+
"inlineSchemaHash": "93bbcef5de3b188d71944d803396764b31692d8a953394f425d307174f0fc051",
|
|
218
|
+
"copyEngine": true
|
|
219
|
+
}
|
|
220
|
+
config.dirname = '/'
|
|
221
|
+
|
|
222
|
+
config.runtimeDataModel = JSON.parse("{\"models\":{\"Warehouse\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"province\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"district\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"ward\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"inventoryItems\",\"kind\":\"object\",\"type\":\"InventoryItem\",\"relationName\":\"InventoryItemToWarehouse\"},{\"name\":\"reservations\",\"kind\":\"object\",\"type\":\"InventoryReservation\",\"relationName\":\"InventoryReservationToWarehouse\"},{\"name\":\"ledgers\",\"kind\":\"object\",\"type\":\"InventoryLedger\",\"relationName\":\"InventoryLedgerToWarehouse\"}],\"dbName\":\"warehouses\"},\"InventoryItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"warehouseId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantityOnHand\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"quantityReserved\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"version\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"warehouse\",\"kind\":\"object\",\"type\":\"Warehouse\",\"relationName\":\"InventoryItemToWarehouse\"}],\"dbName\":\"inventory_items\"},\"InventoryReservation\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"warehouseId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"orderId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiredAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"warehouse\",\"kind\":\"object\",\"type\":\"Warehouse\",\"relationName\":\"InventoryReservationToWarehouse\"}],\"dbName\":\"inventory_reservations\"},\"InventoryLedger\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"warehouseId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"balanceAfter\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"referenceId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"note\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"warehouse\",\"kind\":\"object\",\"type\":\"Warehouse\",\"relationName\":\"InventoryLedgerToWarehouse\"}],\"dbName\":\"inventory_ledgers\"}},\"enums\":{},\"types\":{}}")
|
|
223
|
+
defineDmmfProperty(exports.Prisma, config.runtimeDataModel)
|
|
224
|
+
config.engineWasm = {
|
|
225
|
+
getRuntime: async () => require('./query_engine_bg.js'),
|
|
226
|
+
getQueryEngineWasmModule: async () => {
|
|
227
|
+
const loader = (await import('#wasm-engine-loader')).default
|
|
228
|
+
const engine = (await loader).default
|
|
229
|
+
return engine
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
config.compilerWasm = undefined
|
|
233
|
+
|
|
234
|
+
config.injectableEdgeEnv = () => ({
|
|
235
|
+
parsed: {
|
|
236
|
+
DATABASE_INVENTORY_URL: typeof globalThis !== 'undefined' && globalThis['DATABASE_INVENTORY_URL'] || typeof process !== 'undefined' && process.env && process.env.DATABASE_INVENTORY_URL || undefined
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
if (typeof globalThis !== 'undefined' && globalThis['DEBUG'] || typeof process !== 'undefined' && process.env && process.env.DEBUG || undefined) {
|
|
241
|
+
Debug.enable(typeof globalThis !== 'undefined' && globalThis['DEBUG'] || typeof process !== 'undefined' && process.env && process.env.DEBUG || undefined)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const PrismaClient = getPrismaClient(config)
|
|
245
|
+
exports.PrismaClient = PrismaClient
|
|
246
|
+
Object.assign(exports, Prisma)
|
|
247
|
+
|