@bingtsingw/orchid-helper 1.0.0 → 1.0.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.
- package/dist/index.js +1 -1
- package/package.json +5 -5
- package/src/base-table.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cuid2 as s}from"@xstools/utility/cuid2";import{uuid25encode as i}from"@xstools/utility/string";import{createBaseTable as
|
|
1
|
+
import{cuid2 as s}from"@xstools/utility/cuid2";import{uuid25encode as i}from"@xstools/utility/string";import{createBaseTable as m}from"orchid-orm";import{v7 as d}from"uuid";var o=e=>()=>e.string(36).primaryKey().default(()=>s()),l=e=>()=>e.string(36).primaryKey().default(()=>{let t="";return typeof Bun<"u"?t=Bun.randomUUIDv7():t=d(),i(t)}),f=e=>()=>e.string(36).primaryKey().default(()=>s(6)),n=e=>()=>e.timestampsNoTZ().createdAt.default(()=>new Date().toISOString()).asDate(),r=e=>()=>e.timestampsNoTZ().updatedAt.default(()=>new Date().toISOString()).asDate(),u=e=>()=>e.timestampNoTZ().asDate().nullable(),D=m({snakeCase:!0,nowSQL:"clock_timestamp()::timestamptz(3) AT TIME ZONE 'UTC'",columnTypes:e=>({...e,xEnum:t=>e.string().narrowType(a=>a()),xJsonText:()=>e.jsonText().encode(t=>{if(typeof t!="object")throw new Error("Invalid value for JSON column");return JSON.stringify(t)}),xTimestamp:()=>e.timestampNoTZ().asDate(),createdAt:n(e),updatedAt:r(e),deletedAt:u(e),cuid:o(e),baseColumns:t=>({id:t?.strategy==="cuid2"?o(e)():t?.strategy==="shortid"?f(e)():l(e)(),createdAt:n(e)(),updatedAt:r(e)(),deletedAt:u(e)()})})});export{D as BaseTable};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bingtsingw/orchid-helper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/bingtsingw/orchid-helper.git",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"extends": "@xstools-dev/eslint-config/base"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@xstools/utility": "^0.
|
|
22
|
-
"uuid": "^
|
|
21
|
+
"@xstools/utility": "^0.23.1",
|
|
22
|
+
"uuid": "^14.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"orchid-orm": "1.62.
|
|
25
|
+
"orchid-orm": "1.62.4"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"orchid-orm": "^1.62.
|
|
28
|
+
"orchid-orm": "^1.62.4"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|
package/src/base-table.ts
CHANGED
|
@@ -46,7 +46,7 @@ const deletedAt = (t: DefaultColumnTypes<DefaultSchemaConfig>) => () => t.timest
|
|
|
46
46
|
|
|
47
47
|
export const BaseTable = createBaseTable({
|
|
48
48
|
snakeCase: true,
|
|
49
|
-
nowSQL: `
|
|
49
|
+
nowSQL: `clock_timestamp()::timestamptz(3) AT TIME ZONE 'UTC'`,
|
|
50
50
|
|
|
51
51
|
columnTypes: (t) => ({
|
|
52
52
|
...t,
|