@spine-event-engine/storage-postgres 2.0.0-snapshot.13
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/LICENSE +201 -0
- package/README.md +102 -0
- package/REFERENCE.md +85 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/postgres/column-mapping.d.ts +33 -0
- package/dist/postgres/column-mapping.d.ts.map +1 -0
- package/dist/postgres/column-mapping.js +93 -0
- package/dist/postgres/column-mapping.js.map +1 -0
- package/dist/postgres/data-type.d.ts +25 -0
- package/dist/postgres/data-type.d.ts.map +1 -0
- package/dist/postgres/data-type.js +29 -0
- package/dist/postgres/data-type.js.map +1 -0
- package/dist/postgres/delivery-cleanup.d.ts +76 -0
- package/dist/postgres/delivery-cleanup.d.ts.map +1 -0
- package/dist/postgres/delivery-cleanup.js +224 -0
- package/dist/postgres/delivery-cleanup.js.map +1 -0
- package/dist/postgres/entity-commit.d.ts +114 -0
- package/dist/postgres/entity-commit.d.ts.map +1 -0
- package/dist/postgres/entity-commit.js +385 -0
- package/dist/postgres/entity-commit.js.map +1 -0
- package/dist/postgres/entity-history.d.ts +85 -0
- package/dist/postgres/entity-history.d.ts.map +1 -0
- package/dist/postgres/entity-history.js +840 -0
- package/dist/postgres/entity-history.js.map +1 -0
- package/dist/postgres/errors.d.ts +51 -0
- package/dist/postgres/errors.d.ts.map +1 -0
- package/dist/postgres/errors.js +113 -0
- package/dist/postgres/errors.js.map +1 -0
- package/dist/postgres/id-column.d.ts +61 -0
- package/dist/postgres/id-column.d.ts.map +1 -0
- package/dist/postgres/id-column.js +165 -0
- package/dist/postgres/id-column.js.map +1 -0
- package/dist/postgres/parameter.d.ts +5 -0
- package/dist/postgres/parameter.d.ts.map +1 -0
- package/dist/postgres/parameter.js +15 -0
- package/dist/postgres/parameter.js.map +1 -0
- package/dist/postgres/record-storage.d.ts +514 -0
- package/dist/postgres/record-storage.d.ts.map +1 -0
- package/dist/postgres/record-storage.js +849 -0
- package/dist/postgres/record-storage.js.map +1 -0
- package/dist/postgres/storage-factory.d.ts +321 -0
- package/dist/postgres/storage-factory.d.ts.map +1 -0
- package/dist/postgres/storage-factory.js +584 -0
- package/dist/postgres/storage-factory.js.map +1 -0
- package/dist/postgres/table-initializer.d.ts +66 -0
- package/dist/postgres/table-initializer.d.ts.map +1 -0
- package/dist/postgres/table-initializer.js +301 -0
- package/dist/postgres/table-initializer.js.map +1 -0
- package/dist/postgres/table-resolver.d.ts +41 -0
- package/dist/postgres/table-resolver.d.ts.map +1 -0
- package/dist/postgres/table-resolver.js +225 -0
- package/dist/postgres/table-resolver.js.map +1 -0
- package/dist/postgres/table-spec.d.ts +40 -0
- package/dist/postgres/table-spec.d.ts.map +1 -0
- package/dist/postgres/table-spec.js +126 -0
- package/dist/postgres/table-spec.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# PostgreSQL storage for Spine TS
|
|
2
|
+
|
|
3
|
+
`@spine-event-engine/storage-postgres` stores Spine TS records in PostgreSQL.
|
|
4
|
+
It is a separate provider package; the existing `storage-rdbms` package remains
|
|
5
|
+
the MySQL provider. PostgreSQL support currently targets PostgreSQL 16 or newer,
|
|
6
|
+
with live acceptance recorded against PostgreSQL 16.15 and 18.6.
|
|
7
|
+
|
|
8
|
+
This is an experimental snapshot package. Use Node 24 or newer. For the precise
|
|
9
|
+
public API and operational rules, see the [coding-agent reference](REFERENCE.md).
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm add @spine-event-engine/storage-postgres@snapshot @spine-event-engine/storage@snapshot @bufbuild/protobuf
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Create the database and schema before starting the application. The adapter
|
|
18
|
+
creates and checks its private tables; it does not create databases or schemas.
|
|
19
|
+
|
|
20
|
+
## First write and read
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { create } from "@bufbuild/protobuf";
|
|
24
|
+
import { StringValueSchema } from "@bufbuild/protobuf/wkt";
|
|
25
|
+
import { RecordSpec } from "@spine-event-engine/storage";
|
|
26
|
+
import { PostgresStorageFactory } from "@spine-event-engine/storage-postgres";
|
|
27
|
+
|
|
28
|
+
const factory = await PostgresStorageFactory.newBuilder()
|
|
29
|
+
.setOptions({ url: "postgresql://user:password@127.0.0.1:5432/spine_app" })
|
|
30
|
+
.build();
|
|
31
|
+
const records = factory.createRecordStorage(
|
|
32
|
+
{ name: "Tasks", multitenant: false },
|
|
33
|
+
new RecordSpec({
|
|
34
|
+
recordType: StringValueSchema,
|
|
35
|
+
idKind: "string",
|
|
36
|
+
extractId: (record) => record.value,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
await records.write(create(StringValueSchema, { value: "task-42" }));
|
|
42
|
+
const stored = await records.read("task-42");
|
|
43
|
+
if (stored?.value !== "task-42") throw new Error("The record was not stored.");
|
|
44
|
+
} finally {
|
|
45
|
+
records.close();
|
|
46
|
+
factory.close();
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The URL must include a database name. Use `postgres:` or `postgresql:` URLs;
|
|
51
|
+
credentials should come from the deployment environment. TLS options, pool
|
|
52
|
+
limits, connection timeout, and an explicit schema are configured through the
|
|
53
|
+
factory options. When no schema is supplied, the factory resolves
|
|
54
|
+
`current_schema()` once and uses that validated schema for all later operations.
|
|
55
|
+
|
|
56
|
+
For multitenancy, configure one database and pool per complete generated
|
|
57
|
+
`TenantId`. A schema is not a substitute for the database boundary. Duplicate
|
|
58
|
+
tenant or database targets are rejected during construction.
|
|
59
|
+
|
|
60
|
+
## Lifecycle and operations
|
|
61
|
+
|
|
62
|
+
Tables are initialized lazily and checked against the expected PostgreSQL
|
|
63
|
+
layout. Each acquired client is released and each transaction is completed or
|
|
64
|
+
rolled back. Call `factory.close()` when the application stops; it is
|
|
65
|
+
idempotent and drains live handles and pools. A closed factory cannot create new
|
|
66
|
+
handles.
|
|
67
|
+
|
|
68
|
+
The provider supports record CRUD, compare-and-set, immutable append, Entity
|
|
69
|
+
state and event history, delivery cleanup, declared-column filtering, sorting,
|
|
70
|
+
limits, offsets, and continuations through the common storage API. It uses
|
|
71
|
+
PostgreSQL `BYTEA`, parameterized `$1`-style values, and PostgreSQL's configured
|
|
72
|
+
text collation. Collation ordering can differ from JavaScript ordering, so
|
|
73
|
+
applications should choose and document their database collation deliberately.
|
|
74
|
+
|
|
75
|
+
`google.protobuf.Timestamp` columns are epoch nanoseconds in `BIGINT`, and
|
|
76
|
+
`spine.core.Version` columns are numeric `INT`. Generated names use the JVM
|
|
77
|
+
physical-name renderer: ASCII unquoted spelling folds to lowercase, names are
|
|
78
|
+
limited to 63 UTF-8 bytes, and case-folded or byte-limit collisions are rejected
|
|
79
|
+
before the database is accessed.
|
|
80
|
+
|
|
81
|
+
## Live integration checks
|
|
82
|
+
|
|
83
|
+
The live suite is opt-in and requires an already running PostgreSQL service.
|
|
84
|
+
No container or database is started automatically:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
SPINE_TS_POSTGRESQL_URL='postgresql://user:password@127.0.0.1:5432/spine_test' \
|
|
88
|
+
SPINE_TS_POSTGRESQL_TENANT_A_URL='postgresql://user:password@127.0.0.1:5432/spine_tenant_a' \
|
|
89
|
+
SPINE_TS_POSTGRESQL_TENANT_B_URL='postgresql://user:password@127.0.0.1:5432/spine_tenant_b' \
|
|
90
|
+
pnpm --filter @spine-event-engine/storage-postgres test:postgresql
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The tenant URLs must name two distinct databases; separate schemas in one
|
|
94
|
+
database do not prove the multitenant boundary.
|
|
95
|
+
|
|
96
|
+
Use `test:postgresql:16` or `test:postgresql:18` when the URL points to the
|
|
97
|
+
corresponding server major. The repository's initial acceptance ran both
|
|
98
|
+
commands successfully against PostgreSQL 16.15 and 18.6.
|
|
99
|
+
|
|
100
|
+
Use a dedicated database account with DDL, metadata, and DML permissions. Keep
|
|
101
|
+
URLs and credentials out of source control, configure TLS for production, and
|
|
102
|
+
plan backups, monitoring, and migrations separately.
|
package/REFERENCE.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @spine-event-engine/storage-postgres reference
|
|
2
|
+
|
|
3
|
+
This reference describes the public PostgreSQL adapter contract for coding
|
|
4
|
+
agents and maintainers.
|
|
5
|
+
|
|
6
|
+
## Public entry point
|
|
7
|
+
|
|
8
|
+
Import `PostgresStorageFactory`, `PostgresStorageFactoryBuilder`,
|
|
9
|
+
`PostgresStorageFactoryOptions`, `PostgresTenantStorageOptions`,
|
|
10
|
+
`PostgresEntityStorageHandle`, `PostgresTableSpec`,
|
|
11
|
+
`PostgresCreateOperation`, `PostgresCreateOperationFactory`, and
|
|
12
|
+
`PostgresColumnSpec` from the package root. Provider errors are
|
|
13
|
+
`PostgresStorageConfigurationError`, `PostgresStorageConnectionError`,
|
|
14
|
+
`PostgresStorageSchemaError`, `PostgresStorageDataError`, and
|
|
15
|
+
`PostgresStorageOperationError`.
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
`PostgresStorageFactory.newBuilder().setOptions(options).build()` configures a
|
|
20
|
+
single database and schema. `setTenantOptions(entries)` configures one database
|
|
21
|
+
and pool per complete generated `TenantId`; every operation selects its tenant
|
|
22
|
+
pool before table, metadata, transaction, lock, or data work. Options include a
|
|
23
|
+
PostgreSQL URL, pool maximum, connection timeout, TLS CA/certificate/key,
|
|
24
|
+
server-certificate verification, and optional schema name. URLs must include a
|
|
25
|
+
database and cannot bypass the explicit options model with fragments or driver
|
|
26
|
+
parameters. The factory proves configured connections during build and
|
|
27
|
+
sanitizes provider errors.
|
|
28
|
+
|
|
29
|
+
PostgreSQL creates tables but not databases or schemas. A missing schema is a
|
|
30
|
+
configuration error. Without an explicit schema, `current_schema()` is resolved
|
|
31
|
+
once while building the target and the validated result is qualified into every
|
|
32
|
+
table and metadata statement.
|
|
33
|
+
|
|
34
|
+
## Physical layout and queries
|
|
35
|
+
|
|
36
|
+
Family tables contain `ID`, `bytes`, declared native columns, and the Entity
|
|
37
|
+
framework columns where applicable. `ID` is the primary key. Payloads and byte
|
|
38
|
+
columns use `BYTEA`; text IDs use `VARCHAR(512)`; ordinary text uses `TEXT`;
|
|
39
|
+
integer, boolean, timestamp, version, `REAL`, and `DOUBLE PRECISION` values use
|
|
40
|
+
their PostgreSQL-native mappings. Existing tables are inspected and never
|
|
41
|
+
altered. Missing, extra, or incompatible columns, defaults, nullability,
|
|
42
|
+
primary keys, or unique constraints reject with `PostgresStorageSchemaError`.
|
|
43
|
+
|
|
44
|
+
The adapter uses `$1` parameters, `IS NOT DISTINCT FROM`, PostgreSQL upsert,
|
|
45
|
+
transaction advisory locks, and a bounded normalized query plan. It preserves
|
|
46
|
+
the common 1,000-bind plan budget and 10,000-row default with one
|
|
47
|
+
overflow lookahead row. The database collation controls text ordering; the
|
|
48
|
+
provider does not invent a JavaScript-compatible collation.
|
|
49
|
+
|
|
50
|
+
Normalized plans support IDs; equal, greater-than, less-than, greater-or-equal,
|
|
51
|
+
and less-or-equal comparisons; nested all/either predicates; declared-column
|
|
52
|
+
ordering; masks; and finite limits. They do not support normalized offsets:
|
|
53
|
+
`RecordQuery.offset` is the separate provider-side pagination feature.
|
|
54
|
+
|
|
55
|
+
`Timestamp` values are stored as epoch nanoseconds in `BIGINT`; `Version` is
|
|
56
|
+
stored as numeric `INT`. The JVM-compatible physical-name renderer folds plain,
|
|
57
|
+
non-reserved ASCII identifiers only. Reserved and quoted-required names preserve
|
|
58
|
+
their spelling; all names reject NUL, unsafe values, 63-byte overflow, and
|
|
59
|
+
collisions before DDL, DML, or catalog inspection.
|
|
60
|
+
|
|
61
|
+
## Lifecycle and errors
|
|
62
|
+
|
|
63
|
+
`factory.close()` is idempotent, closes registered handles, prevents new handle
|
|
64
|
+
creation, and drains pools. Record and Entity handles can close independently.
|
|
65
|
+
Acquired clients are released in `finally` blocks and transactions are always
|
|
66
|
+
committed or rolled back before release. Errors do not include URLs,
|
|
67
|
+
credentials, SQL text, or driver internals.
|
|
68
|
+
|
|
69
|
+
Custom table creation may use `useOperationFactory(factory)` with the exported
|
|
70
|
+
`PostgresTableSpec`, `PostgresCreateOperation`, and
|
|
71
|
+
`PostgresCreateOperationFactory` types. The resolved `table.schema` and
|
|
72
|
+
`table.tableName` identify the target; custom SQL must safely quote both
|
|
73
|
+
identifiers and remain idempotent. Do not import pool, client, catalog, or
|
|
74
|
+
compiler internals.
|
|
75
|
+
|
|
76
|
+
## Live verification
|
|
77
|
+
|
|
78
|
+
The infrastructure suite is intentionally excluded from ordinary CI. Supply
|
|
79
|
+
explicit `SPINE_TS_POSTGRESQL_URL`, `SPINE_TS_POSTGRESQL_TENANT_A_URL`, and
|
|
80
|
+
`SPINE_TS_POSTGRESQL_TENANT_B_URL` values naming three test databases, then run
|
|
81
|
+
the package's `test:postgresql:16`
|
|
82
|
+
or `test:postgresql:18` command against a matching service. The repository
|
|
83
|
+
records successful live acceptance against PostgreSQL 16.15 and 18.6. The four
|
|
84
|
+
skipped cases in each run are the MySQL and Datastore variants in the shared
|
|
85
|
+
Inbox test file; both PostgreSQL Inbox cases run.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PostgresStorageFactory, type PostgresCreateOperation, type PostgresCreateOperationFactory, type PostgresColumnSpec, type PostgresStorageFactoryBuilder, type PostgresStorageFactoryOptions, type PostgresTableSpec, type PostgresTenantStorageOptions, } from "./postgres/storage-factory.js";
|
|
2
|
+
export type { PostgresDdlType } from "./postgres/data-type.js";
|
|
3
|
+
export { PostgresStorageConfigurationError, PostgresStorageConnectionError, PostgresStorageDataError, PostgresStorageOperationError, PostgresStorageSchemaError, } from "./postgres/errors.js";
|
|
4
|
+
export type { PostgresEntityStorageHandle } from "./postgres/entity-history.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,GAClC,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EACL,iCAAiC,EACjC,8BAA8B,EAC9B,wBAAwB,EACxB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
export { PostgresStorageFactory, } from "./postgres/storage-factory.js";
|
|
15
|
+
export { PostgresStorageConfigurationError, PostgresStorageConnectionError, PostgresStorageDataError, PostgresStorageOperationError, PostgresStorageSchemaError, } from "./postgres/errors.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,sBAAsB,GAQvB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EACL,iCAAiC,EACjC,8BAA8B,EAC9B,wBAAwB,EACxB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StringifierRegistry } from "@spine-event-engine/core";
|
|
2
|
+
import type { ColumnMapping, ColumnTypeMapping, RecordColumnType } from "@spine-event-engine/storage";
|
|
3
|
+
import type { PostgresParameter } from "./parameter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts typed Protobuf columns to PostgreSQL-native parameters.
|
|
6
|
+
*
|
|
7
|
+
* The result union lists every JavaScript value produced for a `pg` bind
|
|
8
|
+
* parameter while each conversion preserves its typed Protobuf input.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PostgresColumnMapping implements ColumnMapping<PostgresParameter> {
|
|
11
|
+
#private;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a PostgreSQL-native column mapping.
|
|
14
|
+
*
|
|
15
|
+
* @param stringifiers Provides schema-bound message stringifiers.
|
|
16
|
+
*/
|
|
17
|
+
constructor(stringifiers?: StringifierRegistry);
|
|
18
|
+
/**
|
|
19
|
+
* Returns the native conversion for one declared column type.
|
|
20
|
+
*
|
|
21
|
+
* @typeParam V Protobuf value accepted by the declared column.
|
|
22
|
+
* @param type Identifies the declared Protobuf value type.
|
|
23
|
+
* @returns The PostgreSQL parameter conversion.
|
|
24
|
+
*/
|
|
25
|
+
of<V>(type: RecordColumnType<V>): ColumnTypeMapping<V, PostgresParameter>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a conversion that preserves SQL null values.
|
|
28
|
+
*
|
|
29
|
+
* @returns The null conversion.
|
|
30
|
+
*/
|
|
31
|
+
ofNull(): ColumnTypeMapping<null, PostgresParameter>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=column-mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-mapping.d.ts","sourceRoot":"","sources":["../../src/postgres/column-mapping.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKxD;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,aAAa,CAAC,iBAAiB,CAAC;;IAG5E;;;;OAIG;gBACS,YAAY,GAAE,mBAA+C;IAIzE;;;;;;OAMG;IACH,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,CAAC;IAWzE;;;;OAIG;IACH,MAAM,IAAI,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAGrD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
import { ScalarType } from "@bufbuild/protobuf";
|
|
15
|
+
import { StringifierRegistry } from "@spine-event-engine/core";
|
|
16
|
+
const timestampType = "google.protobuf.Timestamp";
|
|
17
|
+
const versionType = "spine.core.Version";
|
|
18
|
+
/**
|
|
19
|
+
* Converts typed Protobuf columns to PostgreSQL-native parameters.
|
|
20
|
+
*
|
|
21
|
+
* The result union lists every JavaScript value produced for a `pg` bind
|
|
22
|
+
* parameter while each conversion preserves its typed Protobuf input.
|
|
23
|
+
*/
|
|
24
|
+
export class PostgresColumnMapping {
|
|
25
|
+
#stringifiers;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a PostgreSQL-native column mapping.
|
|
28
|
+
*
|
|
29
|
+
* @param stringifiers Provides schema-bound message stringifiers.
|
|
30
|
+
*/
|
|
31
|
+
constructor(stringifiers = new StringifierRegistry()) {
|
|
32
|
+
this.#stringifiers = new StringifierRegistry(stringifiers);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns the native conversion for one declared column type.
|
|
36
|
+
*
|
|
37
|
+
* @typeParam V Protobuf value accepted by the declared column.
|
|
38
|
+
* @param type Identifies the declared Protobuf value type.
|
|
39
|
+
* @returns The PostgreSQL parameter conversion.
|
|
40
|
+
*/
|
|
41
|
+
of(type) {
|
|
42
|
+
if (type.kind === "scalar")
|
|
43
|
+
return PostgresColumnMappings.scalar(type.scalar);
|
|
44
|
+
if (type.kind === "enum")
|
|
45
|
+
return (value) => value;
|
|
46
|
+
if (type.message.typeName === timestampType)
|
|
47
|
+
return (value) => PostgresColumnMappings.timestamp(value);
|
|
48
|
+
if (type.message.typeName === versionType)
|
|
49
|
+
return (value) => PostgresColumnMappings.version(value);
|
|
50
|
+
return (value) => this.#stringifiers.forMessage(type.message).toString(value);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns a conversion that preserves SQL null values.
|
|
54
|
+
*
|
|
55
|
+
* @returns The null conversion.
|
|
56
|
+
*/
|
|
57
|
+
ofNull() {
|
|
58
|
+
return (value) => value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const PostgresColumnMappings = Object.freeze({
|
|
62
|
+
/**
|
|
63
|
+
* Maps a Protobuf scalar to the same value for the PostgreSQL driver.
|
|
64
|
+
*
|
|
65
|
+
* @typeParam V Scalar value accepted by the declared column.
|
|
66
|
+
* @param type Identifies the Protobuf scalar kind.
|
|
67
|
+
* @returns A conversion that preserves the scalar value.
|
|
68
|
+
*/
|
|
69
|
+
scalar(type) {
|
|
70
|
+
void type;
|
|
71
|
+
return (value) => value;
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Converts a Protobuf timestamp to epoch nanoseconds.
|
|
75
|
+
*
|
|
76
|
+
* @param value Protobuf timestamp value.
|
|
77
|
+
* @returns Epoch nanoseconds stored in PostgreSQL.
|
|
78
|
+
*/
|
|
79
|
+
timestamp(value) {
|
|
80
|
+
const timestamp = value;
|
|
81
|
+
return timestamp.seconds * 1000000000n + BigInt(timestamp.nanos);
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Reads the integer value from a Spine version message.
|
|
85
|
+
*
|
|
86
|
+
* @param value Spine version message.
|
|
87
|
+
* @returns Version number stored in PostgreSQL.
|
|
88
|
+
*/
|
|
89
|
+
version(value) {
|
|
90
|
+
return value.number;
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=column-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-mapping.js","sourceRoot":"","sources":["../../src/postgres/column-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAS/D,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAClD,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IACvB,aAAa,CAAsB;IAE5C;;;;OAIG;IACH,YAAY,eAAoC,IAAI,mBAAmB,EAAE;QACvE,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;OAMG;IACH,EAAE,CAAI,IAAyB;QAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9E,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAA0B,CAAC;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,aAAa;YACzC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5D,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,WAAW;YACvC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1D,OAAO,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAA8B,CAAC,CAAC,QAAQ,CAAC,KAAgB,CAAC,CAAC;IAClG,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C;;;;;;OAMG;IACH,MAAM,CAAI,IAAgB;QACxB,KAAK,IAAI,CAAC;QACV,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAA0B,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,KAAc;QACtB,MAAM,SAAS,GAAG,KAA6D,CAAC;QAChF,OAAO,SAAS,CAAC,OAAO,GAAG,WAAc,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,KAAc;QACpB,OAAQ,KAAqC,CAAC,MAAM,CAAC;IACvD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes SQL type names emitted by the PostgreSQL storage provider.
|
|
3
|
+
*/
|
|
4
|
+
interface PostgresDataTypeNames {
|
|
5
|
+
readonly bigInt: "BIGINT";
|
|
6
|
+
readonly boolean: "BOOLEAN";
|
|
7
|
+
readonly bytea: "BYTEA";
|
|
8
|
+
readonly doublePrecision: "DOUBLE PRECISION";
|
|
9
|
+
readonly integer: "INT";
|
|
10
|
+
readonly real: "REAL";
|
|
11
|
+
readonly text: "TEXT";
|
|
12
|
+
readonly varchar512: "VARCHAR(512)";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Lists SQL type names emitted by the PostgreSQL storage provider.
|
|
16
|
+
*
|
|
17
|
+
* The `pg` package exposes numeric wire OIDs, not SQL DDL type names.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PostgresDataTypes: Readonly<PostgresDataTypeNames>;
|
|
20
|
+
/**
|
|
21
|
+
* Lists the DDL type declarations supported by this provider.
|
|
22
|
+
*/
|
|
23
|
+
export type PostgresDdlType = (typeof PostgresDataTypes)[keyof typeof PostgresDataTypes];
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=data-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-type.d.ts","sourceRoot":"","sources":["../../src/postgres/data-type.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,qBAAqB,CAS5D,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Lists SQL type names emitted by the PostgreSQL storage provider.
|
|
16
|
+
*
|
|
17
|
+
* The `pg` package exposes numeric wire OIDs, not SQL DDL type names.
|
|
18
|
+
*/
|
|
19
|
+
export const PostgresDataTypes = Object.freeze({
|
|
20
|
+
bigInt: "BIGINT",
|
|
21
|
+
boolean: "BOOLEAN",
|
|
22
|
+
bytea: "BYTEA",
|
|
23
|
+
doublePrecision: "DOUBLE PRECISION",
|
|
24
|
+
integer: "INT",
|
|
25
|
+
real: "REAL",
|
|
26
|
+
text: "TEXT",
|
|
27
|
+
varchar512: "VARCHAR(512)",
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=data-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-type.js","sourceRoot":"","sources":["../../src/postgres/data-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAgBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAoC,MAAM,CAAC,MAAM,CAAC;IAC9E,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,eAAe,EAAE,kBAAkB;IACnC,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,cAAc;CAC3B,CAAC,CAAC"}
|