@cat-factory/node-server 0.145.0 → 0.147.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/dist/container-content-library-deps.d.ts +14 -0
- package/dist/container-content-library-deps.d.ts.map +1 -1
- package/dist/container-content-library-deps.js +23 -0
- package/dist/container-content-library-deps.js.map +1 -1
- package/dist/container-core-deps.d.ts.map +1 -1
- package/dist/container-core-deps.js +4 -1
- package/dist/container-core-deps.js.map +1 -1
- package/dist/container-run-platform.d.ts +81 -0
- package/dist/container-run-platform.d.ts.map +1 -0
- package/dist/container-run-platform.js +227 -0
- package/dist/container-run-platform.js.map +1 -0
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +15 -208
- package/dist/container.js.map +1 -1
- package/dist/db/schema.d.ts +16 -1134
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +12 -165
- package/dist/db/schema.js.map +1 -1
- package/dist/db/tables/foundational-services.d.ts +652 -0
- package/dist/db/tables/foundational-services.d.ts.map +1 -0
- package/dist/db/tables/foundational-services.js +92 -0
- package/dist/db/tables/foundational-services.js.map +1 -0
- package/dist/db/tables/prompt-fragments.d.ts +659 -0
- package/dist/db/tables/prompt-fragments.d.ts.map +1 -0
- package/dist/db/tables/prompt-fragments.js +105 -0
- package/dist/db/tables/prompt-fragments.js.map +1 -0
- package/dist/db/tables/settings.d.ts +479 -0
- package/dist/db/tables/settings.d.ts.map +1 -0
- package/dist/db/tables/settings.js +95 -0
- package/dist/db/tables/settings.js.map +1 -0
- package/dist/foundationalServices.d.ts +8 -0
- package/dist/foundationalServices.d.ts.map +1 -0
- package/dist/foundationalServices.js +32 -0
- package/dist/foundationalServices.js.map +1 -0
- package/dist/repositories/drizzle/settings.d.ts.map +1 -1
- package/dist/repositories/drizzle/settings.js +14 -0
- package/dist/repositories/drizzle/settings.js.map +1 -1
- package/dist/repositories/foundationalServices.d.ts +32 -0
- package/dist/repositories/foundationalServices.d.ts.map +1 -0
- package/dist/repositories/foundationalServices.js +334 -0
- package/dist/repositories/foundationalServices.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -1
- package/dist/server.js.map +1 -1
- package/drizzle/20260731181106_serious_black_bolt/migration.sql +1 -0
- package/drizzle/20260731181106_serious_black_bolt/snapshot.json +18142 -0
- package/drizzle/20260731183716_foundational_services/migration.sql +59 -0
- package/drizzle/20260731183716_foundational_services/snapshot.json +18917 -0
- package/package.json +20 -20
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm';
|
|
2
|
+
import { bigint, index, integer, pgTable, primaryKey, text, uniqueIndex } from 'drizzle-orm/pg-core';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// The FOUNDATIONAL SERVICES tables, mirroring the Cloudflare D1 tables column-for-column
|
|
5
|
+
// (snake_case field names = column names) exactly as the rest of the Node schema does.
|
|
6
|
+
//
|
|
7
|
+
// One cohesive group — the tiered catalog of shared capabilities an Architect designs against
|
|
8
|
+
// (`foundational_services`), the API contract DOCUMENTS its consumers lazily read
|
|
9
|
+
// (`api_contracts`), and the repo links a sync keeps them fresh from
|
|
10
|
+
// (`foundational_service_sources`). Split out of `../schema.ts` so that module stays within its
|
|
11
|
+
// file-size budget; see docs/initiatives/foundational-services.md.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Foundational services (docs/initiatives/foundational-services.md; mirror of D1 migration 0073).
|
|
14
|
+
// A tiered catalog of shared capabilities an Architect designs against, owner-scoped by an
|
|
15
|
+
// (owner_kind, owner_id) pair exactly like the prompt-fragment library. Identity and DOCUMENTS
|
|
16
|
+
// are separate tables on purpose: the catalog read runs on every design dispatch and must never
|
|
17
|
+
// load a contract body, while only the consumer steps — for only the services the design
|
|
18
|
+
// declared — read `api_contracts.body`.
|
|
19
|
+
export const foundationalServices = pgTable('foundational_services', {
|
|
20
|
+
service_id: text('service_id').notNull(),
|
|
21
|
+
owner_kind: text('owner_kind').notNull(),
|
|
22
|
+
owner_id: text('owner_id').notNull(),
|
|
23
|
+
name: text('name').notNull(),
|
|
24
|
+
summary: text('summary').notNull(),
|
|
25
|
+
description: text('description').notNull().default(''),
|
|
26
|
+
// JSON string[] of capability tags.
|
|
27
|
+
capabilities: text('capabilities').notNull().default('[]'),
|
|
28
|
+
source_id: text('source_id'),
|
|
29
|
+
source_path: text('source_path'),
|
|
30
|
+
pinned_commit: text('pinned_commit'),
|
|
31
|
+
created_at: bigint('created_at', { mode: 'number' }).notNull(),
|
|
32
|
+
updated_at: bigint('updated_at', { mode: 'number' }).notNull(),
|
|
33
|
+
deleted_at: bigint('deleted_at', { mode: 'number' }),
|
|
34
|
+
}, (t) => [
|
|
35
|
+
primaryKey({ columns: [t.owner_kind, t.owner_id, t.service_id] }),
|
|
36
|
+
index('idx_foundational_services_owner')
|
|
37
|
+
.on(t.owner_kind, t.owner_id)
|
|
38
|
+
.where(sql `${t.deleted_at} IS NULL`),
|
|
39
|
+
index('idx_foundational_services_source')
|
|
40
|
+
.on(t.source_id)
|
|
41
|
+
.where(sql `${t.deleted_at} IS NULL`),
|
|
42
|
+
]);
|
|
43
|
+
export const apiContracts = pgTable('api_contracts', {
|
|
44
|
+
owner_kind: text('owner_kind').notNull(),
|
|
45
|
+
owner_id: text('owner_id').notNull(),
|
|
46
|
+
service_id: text('service_id').notNull(),
|
|
47
|
+
contract_id: text('contract_id').notNull(),
|
|
48
|
+
format: text('format').notNull(),
|
|
49
|
+
title: text('title').notNull(),
|
|
50
|
+
// The document verbatim. Never selected by the catalog read (see the table note).
|
|
51
|
+
body: text('body').notNull(),
|
|
52
|
+
// Operations indexed ONCE at write time; JSON string[], empty for the TypeScript formats.
|
|
53
|
+
operations: text('operations').notNull().default('[]'),
|
|
54
|
+
omitted_operations: integer('omitted_operations').notNull().default(0),
|
|
55
|
+
source_path: text('source_path'),
|
|
56
|
+
source_sha: text('source_sha'),
|
|
57
|
+
created_at: bigint('created_at', { mode: 'number' }).notNull(),
|
|
58
|
+
updated_at: bigint('updated_at', { mode: 'number' }).notNull(),
|
|
59
|
+
}, (t) => [
|
|
60
|
+
primaryKey({ columns: [t.owner_kind, t.owner_id, t.service_id, t.contract_id] }),
|
|
61
|
+
index('idx_api_contracts_owner').on(t.owner_kind, t.owner_id, t.service_id),
|
|
62
|
+
]);
|
|
63
|
+
export const foundationalServiceSources = pgTable('foundational_service_sources', {
|
|
64
|
+
id: text('id').primaryKey(),
|
|
65
|
+
owner_kind: text('owner_kind').notNull(),
|
|
66
|
+
owner_id: text('owner_id').notNull(),
|
|
67
|
+
repo_owner: text('repo_owner').notNull(),
|
|
68
|
+
repo_name: text('repo_name').notNull(),
|
|
69
|
+
git_ref: text('git_ref').notNull().default('HEAD'),
|
|
70
|
+
// 'directory' scans <dir_path>/<service>/; 'files' reads an explicit path list for ONE service.
|
|
71
|
+
mode: text('mode').notNull().default('directory'),
|
|
72
|
+
dir_path: text('dir_path').notNull().default(''),
|
|
73
|
+
// JSON string[]; 'files' mode only.
|
|
74
|
+
file_paths: text('file_paths').notNull().default('[]'),
|
|
75
|
+
service_id: text('service_id'),
|
|
76
|
+
service_name: text('service_name'),
|
|
77
|
+
service_summary: text('service_summary'),
|
|
78
|
+
last_synced_commit: text('last_synced_commit'),
|
|
79
|
+
last_synced_at: bigint('last_synced_at', { mode: 'number' }),
|
|
80
|
+
created_at: bigint('created_at', { mode: 'number' }).notNull(),
|
|
81
|
+
deleted_at: bigint('deleted_at', { mode: 'number' }),
|
|
82
|
+
}, (t) => [
|
|
83
|
+
uniqueIndex('idx_foundational_sources_unique').on(t.owner_kind, t.owner_id, t.repo_owner, t.repo_name, t.git_ref, t.dir_path),
|
|
84
|
+
index('idx_foundational_sources_owner')
|
|
85
|
+
.on(t.owner_kind, t.owner_id)
|
|
86
|
+
.where(sql `${t.deleted_at} IS NULL`),
|
|
87
|
+
// The autorefresh sweep drains the oldest-synced live sources in bounded batches.
|
|
88
|
+
index('idx_foundational_sources_stale')
|
|
89
|
+
.on(t.last_synced_at)
|
|
90
|
+
.where(sql `${t.deleted_at} IS NULL`),
|
|
91
|
+
]);
|
|
92
|
+
//# sourceMappingURL=foundational-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundational-services.js","sourceRoot":"","sources":["../../../src/db/tables/foundational-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEpG,8EAA8E;AAC9E,yFAAyF;AACzF,uFAAuF;AACvF,EAAE;AACF,8FAA8F;AAC9F,kFAAkF;AAClF,qEAAqE;AACrE,gGAAgG;AAChG,mEAAmE;AACnE,8EAA8E;AAE9E,kGAAkG;AAClG,2FAA2F;AAC3F,+FAA+F;AAC/F,gGAAgG;AAChG,yFAAyF;AACzF,wCAAwC;AACxC,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CACzC,uBAAuB,EACvB;IACE,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACxC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACxC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;IACpC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IAClC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACtD,oCAAoC;IACpC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1D,SAAS,EAAE,IAAI,CAAC,WAAW,C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