@pdg/drizzle-mssql 0.0.0-stage → 1.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.
@@ -0,0 +1,71 @@
1
+ import { type ColumnBuilderBase } from 'drizzle-orm/column-builder';
2
+ import { type MsSqlTable, type MsSqlTableWithColumns } from 'drizzle-orm/mssql-core';
3
+ import type { BuildColumns, BuildExtraConfigColumns } from 'drizzle-orm/column-builder';
4
+ import type { MsSqlColumnBuilders } from 'drizzle-orm/mssql-core/columns/all';
5
+ import type { MsSqlTableExtraConfigValue } from 'drizzle-orm/mssql-core/table';
6
+ export type ColumnPolicy = {
7
+ insert?: 'blocked' | 'allowed';
8
+ update?: 'blocked' | 'allowed' | 'required';
9
+ timestamp?: 'created' | 'updated';
10
+ };
11
+ export type TablePolicy = {
12
+ updateBlocked?: boolean;
13
+ deleteBlocked?: boolean;
14
+ };
15
+ declare const tableMutationPolicyType: unique symbol;
16
+ declare const policyType: unique symbol;
17
+ declare const tablePolicyType: unique symbol;
18
+ type Mark<T, P extends ColumnPolicy> = T & {
19
+ readonly [policyType]: P;
20
+ };
21
+ declare module 'drizzle-orm/column-builder' {
22
+ interface ColumnBuilder<T, TRuntimeConfig, TExtraConfig> {
23
+ insertBlocked(): Mark<this, {
24
+ insert: 'blocked';
25
+ }>;
26
+ insertAllowed(): Mark<this, {
27
+ insert: 'allowed';
28
+ }>;
29
+ updateBlocked(): Mark<this, {
30
+ update: 'blocked';
31
+ }>;
32
+ updateAllowed(): Mark<this, {
33
+ update: 'allowed';
34
+ }>;
35
+ updateRequired(): Mark<this, {
36
+ update: 'required';
37
+ }>;
38
+ createdAt(): Mark<this, {
39
+ timestamp: 'created';
40
+ }>;
41
+ updatedAt(): Mark<this, {
42
+ timestamp: 'updated';
43
+ }>;
44
+ }
45
+ }
46
+ type Policies<C> = {
47
+ [K in keyof C]: C[K] extends {
48
+ readonly [policyType]: infer P;
49
+ } ? P : {};
50
+ };
51
+ export type TablePolicies<T> = T extends {
52
+ readonly [tablePolicyType]: infer P;
53
+ } ? P : {};
54
+ export type TableMutationPolicy<T> = T extends {
55
+ readonly [tableMutationPolicyType]: infer P;
56
+ } ? P : {};
57
+ type TableResult<N extends string, C extends Record<string, ColumnBuilderBase>, P extends TablePolicy> = MsSqlTableWithColumns<{
58
+ name: N;
59
+ schema: undefined;
60
+ columns: BuildColumns<N, C, 'mssql'>;
61
+ dialect: 'mssql';
62
+ isAlias: false;
63
+ }> & {
64
+ readonly [tablePolicyType]: Policies<C>;
65
+ readonly [tableMutationPolicyType]: P;
66
+ };
67
+ export declare function getColumnPolicies(table: MsSqlTable): Record<string, ColumnPolicy>;
68
+ export declare function getTablePolicy(table: MsSqlTable): TablePolicy;
69
+ type ExtraConfig<N extends string, C extends Record<string, ColumnBuilderBase>> = (self: BuildExtraConfigColumns<N, C, 'mssql'>) => (MsSqlTableExtraConfigValue | MsSqlTableExtraConfigValue[])[];
70
+ export declare function mssqlTable<N extends string, C extends Record<string, ColumnBuilderBase>, const P extends TablePolicy = {}, const Q extends TablePolicy = {}>(name: N, columns: C | ((types: MsSqlColumnBuilders) => C), extraConfigOrPolicy?: ExtraConfig<N, C> | (P & TablePolicy), policy?: Q & TablePolicy): TableResult<N, C, P & Q>;
71
+ export {};
@@ -0,0 +1,71 @@
1
+ import { type ColumnBuilderBase } from 'drizzle-orm/column-builder';
2
+ import { type MsSqlTable, type MsSqlTableWithColumns } from 'drizzle-orm/mssql-core';
3
+ import type { BuildColumns, BuildExtraConfigColumns } from 'drizzle-orm/column-builder';
4
+ import type { MsSqlColumnBuilders } from 'drizzle-orm/mssql-core/columns/all';
5
+ import type { MsSqlTableExtraConfigValue } from 'drizzle-orm/mssql-core/table';
6
+ export type ColumnPolicy = {
7
+ insert?: 'blocked' | 'allowed';
8
+ update?: 'blocked' | 'allowed' | 'required';
9
+ timestamp?: 'created' | 'updated';
10
+ };
11
+ export type TablePolicy = {
12
+ updateBlocked?: boolean;
13
+ deleteBlocked?: boolean;
14
+ };
15
+ declare const tableMutationPolicyType: unique symbol;
16
+ declare const policyType: unique symbol;
17
+ declare const tablePolicyType: unique symbol;
18
+ type Mark<T, P extends ColumnPolicy> = T & {
19
+ readonly [policyType]: P;
20
+ };
21
+ declare module 'drizzle-orm/column-builder' {
22
+ interface ColumnBuilder<T, TRuntimeConfig, TExtraConfig> {
23
+ insertBlocked(): Mark<this, {
24
+ insert: 'blocked';
25
+ }>;
26
+ insertAllowed(): Mark<this, {
27
+ insert: 'allowed';
28
+ }>;
29
+ updateBlocked(): Mark<this, {
30
+ update: 'blocked';
31
+ }>;
32
+ updateAllowed(): Mark<this, {
33
+ update: 'allowed';
34
+ }>;
35
+ updateRequired(): Mark<this, {
36
+ update: 'required';
37
+ }>;
38
+ createdAt(): Mark<this, {
39
+ timestamp: 'created';
40
+ }>;
41
+ updatedAt(): Mark<this, {
42
+ timestamp: 'updated';
43
+ }>;
44
+ }
45
+ }
46
+ type Policies<C> = {
47
+ [K in keyof C]: C[K] extends {
48
+ readonly [policyType]: infer P;
49
+ } ? P : {};
50
+ };
51
+ export type TablePolicies<T> = T extends {
52
+ readonly [tablePolicyType]: infer P;
53
+ } ? P : {};
54
+ export type TableMutationPolicy<T> = T extends {
55
+ readonly [tableMutationPolicyType]: infer P;
56
+ } ? P : {};
57
+ type TableResult<N extends string, C extends Record<string, ColumnBuilderBase>, P extends TablePolicy> = MsSqlTableWithColumns<{
58
+ name: N;
59
+ schema: undefined;
60
+ columns: BuildColumns<N, C, 'mssql'>;
61
+ dialect: 'mssql';
62
+ isAlias: false;
63
+ }> & {
64
+ readonly [tablePolicyType]: Policies<C>;
65
+ readonly [tableMutationPolicyType]: P;
66
+ };
67
+ export declare function getColumnPolicies(table: MsSqlTable): Record<string, ColumnPolicy>;
68
+ export declare function getTablePolicy(table: MsSqlTable): TablePolicy;
69
+ type ExtraConfig<N extends string, C extends Record<string, ColumnBuilderBase>> = (self: BuildExtraConfigColumns<N, C, 'mssql'>) => (MsSqlTableExtraConfigValue | MsSqlTableExtraConfigValue[])[];
70
+ export declare function mssqlTable<N extends string, C extends Record<string, ColumnBuilderBase>, const P extends TablePolicy = {}, const Q extends TablePolicy = {}>(name: N, columns: C | ((types: MsSqlColumnBuilders) => C), extraConfigOrPolicy?: ExtraConfig<N, C> | (P & TablePolicy), policy?: Q & TablePolicy): TableResult<N, C, P & Q>;
71
+ export {};
package/package.json CHANGED
@@ -1,6 +1,90 @@
1
1
  {
2
2
  "name": "@pdg/drizzle-mssql",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "title": "Drizzle for MSSQL",
4
+ "description": "Drizzle ORM MSSQL 보조 라이브러리",
5
+ "version": "1.0.1",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.esm.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.esm.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ }
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/parkdigy/drizzle-mssql.git",
25
+ "baseUrl": "https://github.com/parkdigy/drizzle-mssql"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/parkdigy/drizzle-mssql/issues"
29
+ },
30
+ "homepage": "https://github.com/parkdigy/drizzle-mssql#readme",
31
+ "files": [
32
+ "dist",
33
+ "README.md"
34
+ ],
35
+ "scripts": {
36
+ "dev": "cd examples && npm run dev",
37
+ "watchman:del": "watchman watch-del \"${PWD}\" ; watchman watch-project \"${PWD}\"",
38
+ "build": "npm run watchman:del && npm run test && rollup -c --bundleConfigAsCjs",
39
+ "git:commit": "node .git-commit.cjs",
40
+ "git:push": "git push",
41
+ "git:commit:push": "npm run git:commit && npm run git:push",
42
+ "git:merge:mirror": "node .git-merge.cjs mirror main",
43
+ "reset:gitignore": "git rm -r --cached . && git add .",
44
+ "pub": "npm i && npm run build && npm publish --access=public && [ -f ./.git/hooks/pre-commit ] && rm ./.git/hooks/pre-commit || true",
45
+ "lint": "eslint './src/**/*.ts'",
46
+ "tsc": "tsc --noEmit",
47
+ "reinstall": "npm run reinstall:module",
48
+ "reinstall:module": "rm -rf node_modules && rm -f package-lock.json && npm i",
49
+ "test": "jest"
50
+ },
51
+ "author": "YOUNG CHUL PARK",
52
+ "license": "MIT",
53
+ "readmeFilename": "README.md",
54
+ "keywords": [
55
+ "util",
56
+ "typescript",
57
+ "javascript"
58
+ ],
59
+ "devDependencies": {
60
+ "@eslint/js": "9.39.5",
61
+ "@rollup/plugin-commonjs": "29.0.3",
62
+ "@rollup/plugin-eslint": "9.2.0",
63
+ "@rollup/plugin-node-resolve": "16.0.3",
64
+ "@types/jest": "30.0.0",
65
+ "@types/mssql": "^9.1.11",
66
+ "@types/node": "24.19.2",
67
+ "@typescript-eslint/parser": "8.72.1",
68
+ "eslint": "9.39.5",
69
+ "eslint-config-prettier": "10.1.8",
70
+ "eslint-plugin-prettier": "5.5.7",
71
+ "jest": "30.5.2",
72
+ "prettier": "3.9.10",
73
+ "rollup": "4.67.4",
74
+ "rollup-plugin-delete": "3.0.2",
75
+ "rollup-plugin-peer-deps-external": "2.2.4",
76
+ "rollup-plugin-typescript2": "0.37.0",
77
+ "ts-jest": "29.4.15",
78
+ "ts-node": "10.9.2",
79
+ "typescript": "6.0.3",
80
+ "typescript-eslint": "8.72.1"
81
+ },
82
+ "allowScripts": {
83
+ "@parcel/watcher": true,
84
+ "fsevents": true
85
+ },
86
+ "peerDependencies": {
87
+ "drizzle-orm": "1.0.0-rc.5",
88
+ "mssql": "^11.0.2"
89
+ }
90
+ }