@agentic-db/services 0.2.0
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/CHANGELOG.md +41 -0
- package/LICENSE +20 -0
- package/Makefile +7 -0
- package/README.md +66 -0
- package/__tests__/basic.test.ts +29 -0
- package/agentic-db-services.control +7 -0
- package/deploy/migrate/database.sql +34 -0
- package/deploy/migrate/default_privilege.sql +54 -0
- package/deploy/migrate/field.sql +755 -0
- package/deploy/migrate/foreign_key_constraint.sql +151 -0
- package/deploy/migrate/full_text_search.sql +43 -0
- package/deploy/migrate/index.sql +350 -0
- package/deploy/migrate/primary_key_constraint.sql +91 -0
- package/deploy/migrate/schema.sql +38 -0
- package/deploy/migrate/schema_grant.sql +42 -0
- package/deploy/migrate/table.sql +125 -0
- package/deploy/migrate/trigger.sql +173 -0
- package/deploy/migrate/trigger_function.sql +102 -0
- package/jest.config.js +20 -0
- package/package.json +28 -0
- package/pgpm.plan +16 -0
- package/revert/migrate/database.sql +6 -0
- package/revert/migrate/default_privilege.sql +6 -0
- package/revert/migrate/field.sql +6 -0
- package/revert/migrate/foreign_key_constraint.sql +6 -0
- package/revert/migrate/full_text_search.sql +6 -0
- package/revert/migrate/index.sql +6 -0
- package/revert/migrate/primary_key_constraint.sql +6 -0
- package/revert/migrate/schema.sql +6 -0
- package/revert/migrate/schema_grant.sql +6 -0
- package/revert/migrate/table.sql +6 -0
- package/revert/migrate/trigger.sql +6 -0
- package/revert/migrate/trigger_function.sql +6 -0
- package/verify/migrate/database.sql +6 -0
- package/verify/migrate/default_privilege.sql +6 -0
- package/verify/migrate/field.sql +6 -0
- package/verify/migrate/foreign_key_constraint.sql +6 -0
- package/verify/migrate/full_text_search.sql +6 -0
- package/verify/migrate/index.sql +6 -0
- package/verify/migrate/primary_key_constraint.sql +6 -0
- package/verify/migrate/schema.sql +6 -0
- package/verify/migrate/schema_grant.sql +6 -0
- package/verify/migrate/table.sql +6 -0
- package/verify/migrate/trigger.sql +6 -0
- package/verify/migrate/trigger_function.sql +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [0.2.0](https://github.com/constructive-io/agentic-db/compare/@agentic-db/services@0.1.0...@agentic-db/services@0.2.0) (2026-04-16)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- remove publishConfig.directory from pgpm SQL packages ([70b4e75](https://github.com/constructive-io/agentic-db/commit/70b4e7588497a7cce70c88c0f9fdf955c6ffdc08))
|
|
11
|
+
|
|
12
|
+
# 0.1.0 (2026-04-16)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- add explicit chunk table definitions for all 32 DataSearch tables ([b69b5f8](https://github.com/constructive-io/agentic-db/commit/b69b5f8cbc44b4ebca9e1111f298e875e946cc65))
|
|
17
|
+
- add missing semicolon after last INSERT row in trigger.sql ([21b7212](https://github.com/constructive-io/agentic-db/commit/21b7212c99f38256698116aad1d3e7d528af65a2))
|
|
18
|
+
- move chunks config inside embedding object, regenerate SDK with proper chunk tables ([5009bbe](https://github.com/constructive-io/agentic-db/commit/5009bbe013b80a3df3033e68f434ac7040948815))
|
|
19
|
+
- regenerate SDK with domain-based routing, fix membership defaults schema lookup ([dc9f254](https://github.com/constructive-io/agentic-db/commit/dc9f2547eebab788b308bec2fb2caf437beb4343))
|
|
20
|
+
- remove duplicate FK indexes from Phase 3, re-provision and re-export all artifacts ([da7f3ae](https://github.com/constructive-io/agentic-db/commit/da7f3ae20d433349c9f821db5a55547c5fff006a))
|
|
21
|
+
- replace NULL with '{}' for NOT NULL fields/grant_privileges columns in secure_table_provision ([77ed32c](https://github.com/constructive-io/agentic-db/commit/77ed32cf1f31fb2decf189ffc18e4557db05e256))
|
|
22
|
+
- surgically remove codebase rows from services SQL without breaking INSERT syntax ([7905701](https://github.com/constructive-io/agentic-db/commit/7905701f6aca98d99cc35512b81a0863cc5c3994))
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
- add chunk tables for contacts and notes (re-provision + export) ([d374f84](https://github.com/constructive-io/agentic-db/commit/d374f84f84028d448a0c8fa721c11bc1d25c9e17))
|
|
27
|
+
- add contact_emails, contact_phones, contact_addresses tables ([650b4e0](https://github.com/constructive-io/agentic-db/commit/650b4e058cdfd8fac9e433014f578ccbd54d4a1a))
|
|
28
|
+
- add DataSearch + chunking to rules, skills, conversations, messages; re-provision and re-export all artifacts ([20168ce](https://github.com/constructive-io/agentic-db/commit/20168ce643ff603e77b911a8e8ee3b79d85c7f45))
|
|
29
|
+
- re-export all artifacts after Data\* nodes migration (DataSearch, DataPostGIS, DataEmbedding) ([b072c3f](https://github.com/constructive-io/agentic-db/commit/b072c3fdc82661cc68d0ded8d565c108a0171995))
|
|
30
|
+
- re-export all artifacts with header-based routing fix ([905ed34](https://github.com/constructive-io/agentic-db/commit/905ed347770686e096d60700ffcb64d05dd8a77f))
|
|
31
|
+
- re-export pgpm, schema, SDK, CLI with trips.tags GIN index fix ([cbc0e37](https://github.com/constructive-io/agentic-db/commit/cbc0e37b8bf414677b101502498e1ebfda7f99c0))
|
|
32
|
+
- re-provision and re-export with BM25 fully enabled (no SKIP_BM25) ([f03a62c](https://github.com/constructive-io/agentic-db/commit/f03a62cf6b8166022ffea19c20fc820e176fd6a1))
|
|
33
|
+
- re-provision database and regenerate all codegen ([78b058e](https://github.com/constructive-io/agentic-db/commit/78b058e72788cc150b3abd8fa69d043321ea6103))
|
|
34
|
+
- re-provision database without security and export clean pgpm workspace ([9b733a2](https://github.com/constructive-io/agentic-db/commit/9b733a22636cf5242e2d55b30c172ae4d0b9603a))
|
|
35
|
+
- re-provision with PR [#664](https://github.com/constructive-io/agentic-db/issues/664), add deploy/export scripts and CI workflow ([25a0069](https://github.com/constructive-io/agentic-db/commit/25a0069fb243853fca1951354946da5192d0a4ad))
|
|
36
|
+
- remove all grants/roles from blueprints and agentic-db-services ([9c57baf](https://github.com/constructive-io/agentic-db/commit/9c57baf0320707179a916d789a55f43dae6b7061))
|
|
37
|
+
- remove all security/RLS from provision blueprints and agentic-db-services ([3c6880b](https://github.com/constructive-io/agentic-db/commit/3c6880bd8cf87bbbf2ac24eecca7cd2637be3751))
|
|
38
|
+
- remove social fields from contacts table ([303ecb9](https://github.com/constructive-io/agentic-db/commit/303ecb9c985e6f7d840d9c8525f8cba34649af73))
|
|
39
|
+
- reprovision agentic-db against latest constructive-db ([5f42408](https://github.com/constructive-io/agentic-db/commit/5f42408338e2f6ee99a4b8f82f9243fd63eb899a))
|
|
40
|
+
- use bare database.create() with zero modules, re-provision and re-export clean pgpm workspace ([2227b7c](https://github.com/constructive-io/agentic-db/commit/2227b7c90e8963294691f2de92c8358bb5bc5784))
|
|
41
|
+
- use DataEmbedding chunks plugin instead of manual chunk tables ([c7674d1](https://github.com/constructive-io/agentic-db/commit/c7674d1e3f8a5d61e85e07200abf1f8eac4fd83f))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2026 Dan Lynch <pyramation@gmail.com>
|
|
2
|
+
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
exclusive property of the copyright holder. No part of the Software may be
|
|
7
|
+
reproduced, distributed, modified, or transmitted in any form or by any means,
|
|
8
|
+
including photocopying, recording, or other electronic or mechanical methods,
|
|
9
|
+
without the prior written permission of the copyright holder.
|
|
10
|
+
|
|
11
|
+
Unauthorized copying, modification, distribution, or use of this Software,
|
|
12
|
+
via any medium, is strictly prohibited.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/Makefile
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @agentic-db/services
|
|
2
|
+
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img height="250" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center" width="100%">
|
|
8
|
+
<a href="https://github.com/constructive-io/agentic-db/actions/workflows/integration-test.yml">
|
|
9
|
+
<img height="20" src="https://github.com/constructive-io/agentic-db/actions/workflows/integration-test.yml/badge.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@agentic-db/services"><img height="20" src="https://img.shields.io/npm/v/@agentic-db/services"/></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
Services metadata extension for `agentic-db`. This pgpm module registers API endpoints, domains, and site configuration in the Constructive `services` schema so the GraphQL server knows how to route requests.
|
|
15
|
+
|
|
16
|
+
This module is automatically deployed as a dependency when you deploy `agentic-db`.
|
|
17
|
+
|
|
18
|
+
## What It Does
|
|
19
|
+
|
|
20
|
+
- Registers the `agentic.localhost` API endpoint (app schema)
|
|
21
|
+
- Registers the `auth.localhost` API endpoint (auth schema)
|
|
22
|
+
- Configures domain routing for the PostGraphile GraphQL server
|
|
23
|
+
- Links database schemas to their corresponding API surfaces
|
|
24
|
+
|
|
25
|
+
## Deploy
|
|
26
|
+
|
|
27
|
+
This module is typically deployed alongside `agentic-db`:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Deploy both modules together (recommended)
|
|
31
|
+
pgpm deploy --createdb --database agentic-db --yes --package agentic-db
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
To deploy this module independently:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Standalone deploy (requires agentic-db already deployed)
|
|
38
|
+
pgpm deploy --database agentic-db --yes --package agentic-db-services
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Module Dependencies
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
agentic-db-services
|
|
45
|
+
requires: plpgsql, metaschema-schema, metaschema-modules, services
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Developing
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Run tests
|
|
52
|
+
pnpm test
|
|
53
|
+
|
|
54
|
+
# Watch mode
|
|
55
|
+
pnpm test:watch
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Credits
|
|
59
|
+
|
|
60
|
+
Built by the [Constructive](https://constructive.io) team -- creators of modular Postgres tooling for secure, composable backends. Contribute on [GitHub](https://github.com/constructive-io).
|
|
61
|
+
|
|
62
|
+
## Disclaimer
|
|
63
|
+
|
|
64
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
65
|
+
|
|
66
|
+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getConnections, PgTestClient } from 'pgsql-test';
|
|
2
|
+
|
|
3
|
+
let db: PgTestClient;
|
|
4
|
+
let pg: PgTestClient;
|
|
5
|
+
let teardown: () => Promise<void>;
|
|
6
|
+
|
|
7
|
+
beforeAll(async () => {
|
|
8
|
+
({ pg, db, teardown } = await getConnections());
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
afterAll(async () => {
|
|
12
|
+
await teardown();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
await db.beforeEach();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterEach(async () => {
|
|
20
|
+
await db.afterEach();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('first test', () => {
|
|
24
|
+
it('should pass', async () => {
|
|
25
|
+
const result = await pg.query('SELECT 1 as num');
|
|
26
|
+
expect(result.rows[0].num).toBe(1);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- Deploy: migrate/database
|
|
2
|
+
-- made with <3 @ constructive.io
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
SET session_replication_role TO replica;
|
|
8
|
+
-- using replica in case we are deploying triggers to metaschema_public
|
|
9
|
+
|
|
10
|
+
-- unaccent, postgis affected and require grants
|
|
11
|
+
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public to public;
|
|
12
|
+
|
|
13
|
+
DO $LQLMIGRATION$
|
|
14
|
+
DECLARE
|
|
15
|
+
BEGIN
|
|
16
|
+
|
|
17
|
+
EXECUTE format('GRANT CONNECT ON DATABASE %I TO %I', current_database(), 'app_user');
|
|
18
|
+
EXECUTE format('GRANT CONNECT ON DATABASE %I TO %I', current_database(), 'app_admin');
|
|
19
|
+
|
|
20
|
+
END;
|
|
21
|
+
$LQLMIGRATION$;
|
|
22
|
+
|
|
23
|
+
INSERT INTO metaschema_public.database (
|
|
24
|
+
id,
|
|
25
|
+
owner_id,
|
|
26
|
+
name,
|
|
27
|
+
hash
|
|
28
|
+
) VALUES
|
|
29
|
+
('019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae66-74ab-8d9f-efbdb95c4fa3', 'agentic-db-1776313281431', '593ef8e3-d5fc-5ac3-86e4-7381881a0b1d');
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
SET session_replication_role TO DEFAULT;
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
-- Deploy: migrate/default_privilege
|
|
2
|
+
-- made with <3 @ constructive.io
|
|
3
|
+
|
|
4
|
+
-- requires: migrate/schema_grant
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
SET session_replication_role TO replica;
|
|
8
|
+
-- using replica in case we are deploying triggers to metaschema_public
|
|
9
|
+
|
|
10
|
+
-- unaccent, postgis affected and require grants
|
|
11
|
+
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public to public;
|
|
12
|
+
|
|
13
|
+
DO $LQLMIGRATION$
|
|
14
|
+
DECLARE
|
|
15
|
+
BEGIN
|
|
16
|
+
|
|
17
|
+
EXECUTE format('GRANT CONNECT ON DATABASE %I TO %I', current_database(), 'app_user');
|
|
18
|
+
EXECUTE format('GRANT CONNECT ON DATABASE %I TO %I', current_database(), 'app_admin');
|
|
19
|
+
|
|
20
|
+
END;
|
|
21
|
+
$LQLMIGRATION$;
|
|
22
|
+
|
|
23
|
+
INSERT INTO metaschema_public.default_privilege (
|
|
24
|
+
id,
|
|
25
|
+
database_id,
|
|
26
|
+
schema_id,
|
|
27
|
+
object_type,
|
|
28
|
+
privilege,
|
|
29
|
+
grantee_name,
|
|
30
|
+
is_grant
|
|
31
|
+
) VALUES
|
|
32
|
+
('019d9485-aee9-7836-aa7d-1d4a7b774175', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae98-7486-bdee-7e5665e75d4e', 'tables', 'ALL', 'administrator', true),
|
|
33
|
+
('019d9485-aef9-7c46-9c7d-fccefd245842', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae98-7486-bdee-7e5665e75d4e', 'sequences', 'ALL', 'administrator', true),
|
|
34
|
+
('019d9485-af04-73c1-9702-c34d1caa145e', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae98-7486-bdee-7e5665e75d4e', 'functions', 'ALL', 'administrator', true),
|
|
35
|
+
('019d9485-af0e-7f14-a7c8-a48080977211', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae98-7486-bdee-7e5665e75d4e', 'functions', 'ALL', 'authenticated', true),
|
|
36
|
+
('019d9485-af19-7333-80c8-d0e2ac2f11cc', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae98-7486-bdee-7e5665e75d4e', 'sequences', 'ALL', 'authenticated', true),
|
|
37
|
+
('019d9485-af23-7360-b748-d6c3f40e70a5', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae98-7486-bdee-7e5665e75d4e', 'functions', 'ALL', 'anonymous', true),
|
|
38
|
+
('019d9485-af67-70f1-b560-e436be77d04e', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae99-7c98-95a8-72262cca2013', 'tables', 'ALL', 'administrator', true),
|
|
39
|
+
('019d9485-af74-767d-85e8-abd080cc03a7', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae99-7c98-95a8-72262cca2013', 'sequences', 'ALL', 'administrator', true),
|
|
40
|
+
('019d9485-af7e-791f-8e72-5dec6de8289a', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae99-7c98-95a8-72262cca2013', 'functions', 'ALL', 'administrator', true),
|
|
41
|
+
('019d9485-af88-7729-9916-243b76f42bfb', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae99-7c98-95a8-72262cca2013', 'functions', 'ALL', 'authenticated', true),
|
|
42
|
+
('019d9485-af93-7062-8520-58b00f8ef73f', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae99-7c98-95a8-72262cca2013', 'sequences', 'ALL', 'authenticated', true),
|
|
43
|
+
('019d9485-af9c-7dfc-90c7-79f5bd187e6e', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', '019d9485-ae99-7c98-95a8-72262cca2013', 'functions', 'ALL', 'anonymous', true),
|
|
44
|
+
('038967c0-df0a-696b-d50d-792ffccba699', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', 'aab79318-871f-4662-f1ad-a54577207291', 'sequences', 'ALL', 'administrator', true),
|
|
45
|
+
('2872adb1-257d-d81f-ba56-63d3195f784f', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', 'aab79318-871f-4662-f1ad-a54577207291', 'sequences', 'ALL', 'authenticated', true),
|
|
46
|
+
('c4e2ab29-4a6a-3a30-fc6e-9f9399deb985', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', 'aab79318-871f-4662-f1ad-a54577207291', 'functions', 'ALL', 'administrator', true),
|
|
47
|
+
('c6903608-8e8e-5aa4-d5d9-fde6b116b18e', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', 'aab79318-871f-4662-f1ad-a54577207291', 'functions', 'ALL', 'authenticated', true),
|
|
48
|
+
('d1a4b009-8243-ed1e-2080-a3558c3cfb8d', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', 'aab79318-871f-4662-f1ad-a54577207291', 'tables', 'ALL', 'administrator', true),
|
|
49
|
+
('fffb1677-d848-897d-fc8f-896d70260456', '019d9485-ae8c-71c9-a962-9a8ebcbe2199', 'aab79318-871f-4662-f1ad-a54577207291', 'functions', 'ALL', 'anonymous', true);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
SET session_replication_role TO DEFAULT;
|
|
53
|
+
|
|
54
|
+
|