@voyantjs/suppliers 0.6.7 → 0.6.9
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/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +4 -3
- package/dist/service-core.d.ts.map +1 -1
- package/dist/service-core.js +13 -30
- package/package.json +6 -6
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,gBAAgB,sHAQ3B,CAAA;AAEF,eAAO,MAAM,kBAAkB,yEAA+D,CAAA;AAE9F,eAAO,MAAM,eAAe,6GAO1B,CAAA;AAEF,eAAO,MAAM,YAAY,uGAMvB,CAAA;AAEF,eAAO,MAAM,0BAA0B,sFAKrC,CAAA;AAIF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,gBAAgB,sHAQ3B,CAAA;AAEF,eAAO,MAAM,kBAAkB,yEAA+D,CAAA;AAE9F,eAAO,MAAM,eAAe,6GAO1B,CAAA;AAEF,eAAO,MAAM,YAAY,uGAMvB,CAAA;AAEF,eAAO,MAAM,0BAA0B,sFAKrC,CAAA;AAIF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAA;AAEH,eAAO,MAAM,qCAAqC;;EAQjD,CAAA;AAED,eAAO,MAAM,yBAAyB;;;;EAOnC,CAAA;AAEH,eAAO,MAAM,sBAAsB;;EAKhC,CAAA;AAEH,eAAO,MAAM,sBAAsB;;EAEhC,CAAA;AAEH,eAAO,MAAM,6BAA6B;;EAKvC,CAAA;AAEH,eAAO,MAAM,0BAA0B;;EAKpC,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -52,9 +52,10 @@ export const suppliers = pgTable("suppliers", {
|
|
|
52
52
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
53
53
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
54
54
|
}, (table) => [
|
|
55
|
-
index("
|
|
56
|
-
index("
|
|
57
|
-
index("
|
|
55
|
+
index("idx_suppliers_created").on(table.createdAt),
|
|
56
|
+
index("idx_suppliers_type_created").on(table.type, table.createdAt),
|
|
57
|
+
index("idx_suppliers_status_created").on(table.status, table.createdAt),
|
|
58
|
+
index("idx_suppliers_primary_facility_created").on(table.primaryFacilityId, table.createdAt),
|
|
58
59
|
]);
|
|
59
60
|
// ---------- supplier_directory_projections ----------
|
|
60
61
|
export const supplierDirectoryProjections = pgTable("supplier_directory_projections", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-core.d.ts","sourceRoot":"","sources":["../src/service-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-core.d.ts","sourceRoot":"","sources":["../src/service-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAG5B,wBAAsB,aAAa,CAAC,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,iBAAiB;;;;;;;;;;;;;;;;;GA2DnF;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;kEAQvE;AAED,wBAAsB,cAAc,CAAC,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;GA2CrF;AAED,wBAAsB,cAAc,CAClC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;UAqD1B;AAED,wBAAsB,cAAc,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;UAMtE"}
|
package/dist/service-core.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { identityAddresses, identityContactPoints, identityNamedContacts, } from "@voyantjs/identity/schema";
|
|
2
1
|
import { and, eq, sql } from "drizzle-orm";
|
|
3
|
-
import { suppliers } from "./schema.js";
|
|
4
|
-
import { hydrateSuppliers,
|
|
2
|
+
import { supplierDirectoryProjections, suppliers } from "./schema.js";
|
|
3
|
+
import { hydrateSuppliers, syncSupplierIdentity } from "./service-shared.js";
|
|
5
4
|
export async function listSuppliers(db, query) {
|
|
6
5
|
const conditions = [];
|
|
7
6
|
if (query.type) {
|
|
@@ -20,34 +19,18 @@ export async function listSuppliers(db, query) {
|
|
|
20
19
|
or
|
|
21
20
|
exists (
|
|
22
21
|
select 1
|
|
23
|
-
from ${
|
|
24
|
-
where ${
|
|
25
|
-
and ${identityContactPoints.entityId} = ${suppliers.id}
|
|
22
|
+
from ${supplierDirectoryProjections}
|
|
23
|
+
where ${supplierDirectoryProjections.supplierId} = ${suppliers.id}
|
|
26
24
|
and (
|
|
27
|
-
${
|
|
28
|
-
or ${
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
and (
|
|
37
|
-
${identityNamedContacts.name} ilike ${term}
|
|
38
|
-
or ${identityNamedContacts.email} ilike ${term}
|
|
39
|
-
or ${identityNamedContacts.phone} ilike ${term}
|
|
40
|
-
)
|
|
41
|
-
)
|
|
42
|
-
or exists (
|
|
43
|
-
select 1
|
|
44
|
-
from ${identityAddresses}
|
|
45
|
-
where ${identityAddresses.entityType} = ${supplierEntityType}
|
|
46
|
-
and ${identityAddresses.entityId} = ${suppliers.id}
|
|
47
|
-
and (
|
|
48
|
-
${identityAddresses.fullText} ilike ${term}
|
|
49
|
-
or ${identityAddresses.city} ilike ${term}
|
|
50
|
-
or ${identityAddresses.country} ilike ${term}
|
|
25
|
+
${supplierDirectoryProjections.email} ilike ${term}
|
|
26
|
+
or ${supplierDirectoryProjections.phone} ilike ${term}
|
|
27
|
+
or ${supplierDirectoryProjections.website} ilike ${term}
|
|
28
|
+
or ${supplierDirectoryProjections.address} ilike ${term}
|
|
29
|
+
or ${supplierDirectoryProjections.city} ilike ${term}
|
|
30
|
+
or ${supplierDirectoryProjections.country} ilike ${term}
|
|
31
|
+
or ${supplierDirectoryProjections.contactName} ilike ${term}
|
|
32
|
+
or ${supplierDirectoryProjections.contactEmail} ilike ${term}
|
|
33
|
+
or ${supplierDirectoryProjections.contactPhone} ilike ${term}
|
|
51
34
|
)
|
|
52
35
|
)
|
|
53
36
|
)`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/suppliers",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"drizzle-orm": "^0.45.2",
|
|
26
26
|
"hono": "^4.12.10",
|
|
27
27
|
"zod": "^4.3.6",
|
|
28
|
-
"@voyantjs/core": "0.6.
|
|
29
|
-
"@voyantjs/db": "0.6.
|
|
30
|
-
"@voyantjs/facilities": "0.6.
|
|
31
|
-
"@voyantjs/hono": "0.6.
|
|
32
|
-
"@voyantjs/identity": "0.6.
|
|
28
|
+
"@voyantjs/core": "0.6.9",
|
|
29
|
+
"@voyantjs/db": "0.6.9",
|
|
30
|
+
"@voyantjs/facilities": "0.6.9",
|
|
31
|
+
"@voyantjs/hono": "0.6.9",
|
|
32
|
+
"@voyantjs/identity": "0.6.9"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^6.0.2",
|