@jskit-ai/database-runtime 0.1.148 → 0.1.150
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/database-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.150",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -25,6 +25,112 @@
|
|
|
25
25
|
"./shared/transactions": "./src/shared/transactions.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jskit-ai/kernel": "0.1.
|
|
28
|
+
"@jskit-ai/kernel": "0.1.150"
|
|
29
|
+
},
|
|
30
|
+
"jskit": {
|
|
31
|
+
"kind": "runtime",
|
|
32
|
+
"capabilities": {
|
|
33
|
+
"provides": [
|
|
34
|
+
"runtime.database"
|
|
35
|
+
],
|
|
36
|
+
"requires": [
|
|
37
|
+
"runtime.database.driver"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"runtime": {
|
|
41
|
+
"server": {
|
|
42
|
+
"providerEntrypoint": "src/server/providers/DatabaseRuntimeServiceProvider.js",
|
|
43
|
+
"providers": [
|
|
44
|
+
{
|
|
45
|
+
"entrypoint": "src/server/providers/DatabaseRuntimeServiceProvider.js",
|
|
46
|
+
"export": "DatabaseRuntimeServiceProvider"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"client": {
|
|
51
|
+
"providers": []
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"metadata": {
|
|
55
|
+
"apiSummary": {
|
|
56
|
+
"surfaces": [
|
|
57
|
+
{
|
|
58
|
+
"subpath": "./server",
|
|
59
|
+
"summary": "Exports DatabaseRuntimeServiceProvider plus registerDatabaseRuntime for server container wiring."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"subpath": "./shared",
|
|
63
|
+
"summary": "Exports shared Knex runtime utilities (transaction manager, repository helpers, retention/json/date/dialect helpers)."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"subpath": "./client",
|
|
67
|
+
"summary": "Exports no runtime API today (reserved client entrypoint)."
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"containerTokens": {
|
|
71
|
+
"server": [
|
|
72
|
+
"runtime.database",
|
|
73
|
+
"runtime.database.driver",
|
|
74
|
+
"jskit.database.knex",
|
|
75
|
+
"jskit.database.transactionManager"
|
|
76
|
+
],
|
|
77
|
+
"client": []
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"ci": {
|
|
82
|
+
"environment": {},
|
|
83
|
+
"services": [],
|
|
84
|
+
"steps": [
|
|
85
|
+
{
|
|
86
|
+
"id": "database-migrations",
|
|
87
|
+
"phase": "before-verify",
|
|
88
|
+
"label": "Apply database migrations",
|
|
89
|
+
"command": "npm run db:migrate"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"mutations": {
|
|
94
|
+
"dependencies": {
|
|
95
|
+
"runtime": {
|
|
96
|
+
"@jskit-ai/kernel": "0.1.150",
|
|
97
|
+
"dotenv": "^16.4.5",
|
|
98
|
+
"knex": "^3.1.0"
|
|
99
|
+
},
|
|
100
|
+
"dev": {}
|
|
101
|
+
},
|
|
102
|
+
"packageJson": {
|
|
103
|
+
"scripts": {
|
|
104
|
+
"db:migrations:sync": "jskit migrations sync",
|
|
105
|
+
"db:migrate": "npm run db:migrations:sync && knex --knexfile ./knexfile.js migrate:latest",
|
|
106
|
+
"db:migrate:rollback": "knex --knexfile ./knexfile.js migrate:rollback",
|
|
107
|
+
"db:migrate:status": "npm run db:migrations:sync && knex --knexfile ./knexfile.js migrate:list"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"procfile": {},
|
|
111
|
+
"files": [
|
|
112
|
+
{
|
|
113
|
+
"from": "templates/knexfile.js",
|
|
114
|
+
"to": "knexfile.js",
|
|
115
|
+
"reason": "Install root Knex configuration so app scripts can run migrations through Knex CLI.",
|
|
116
|
+
"category": "database-runtime",
|
|
117
|
+
"id": "database-runtime-knexfile"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"from": "templates/migrations/.gitkeep",
|
|
121
|
+
"to": "migrations/.gitkeep",
|
|
122
|
+
"reason": "Ensure migrations directory exists so Knex migration commands can run before any module installs migrations.",
|
|
123
|
+
"category": "database-runtime",
|
|
124
|
+
"id": "database-runtime-migrations-dir"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"from": "templates/migrations/constraints/.gitkeep",
|
|
128
|
+
"to": "migrations/constraints/.gitkeep",
|
|
129
|
+
"reason": "Ensure the ordered deferred-constraint migration directory exists.",
|
|
130
|
+
"category": "database-runtime",
|
|
131
|
+
"id": "database-runtime-constraint-migrations-dir"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
29
135
|
}
|
|
30
136
|
}
|
|
@@ -42,7 +42,7 @@ function loadKnexFactory() {
|
|
|
42
42
|
moduleValue = symlinkSafeRequire("knex");
|
|
43
43
|
} catch {
|
|
44
44
|
throw new Error(
|
|
45
|
-
"Knex package is not installed.
|
|
45
|
+
"Knex package is not installed. Run `npm install`, then `npx jskit migrations sync`."
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -3,14 +3,16 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import test from "node:test";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import
|
|
6
|
+
import packageJson from "../package.json" with { type: "json" };
|
|
7
|
+
|
|
8
|
+
const packageMetadata = packageJson.jskit;
|
|
7
9
|
|
|
8
10
|
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
9
11
|
|
|
10
12
|
test("database-runtime db migrate scripts sync JSKIT-managed migrations before Knex reads them", () => {
|
|
11
|
-
const scripts =
|
|
13
|
+
const scripts = packageMetadata.mutations.packageJson.scripts;
|
|
12
14
|
|
|
13
|
-
assert.equal(scripts["db:migrations:sync"], "jskit migrations
|
|
15
|
+
assert.equal(scripts["db:migrations:sync"], "jskit migrations sync");
|
|
14
16
|
assert.equal(
|
|
15
17
|
scripts["db:migrate"],
|
|
16
18
|
"npm run db:migrations:sync && knex --knexfile ./knexfile.js migrate:latest"
|
|
@@ -23,7 +25,7 @@ test("database-runtime db migrate scripts sync JSKIT-managed migrations before K
|
|
|
23
25
|
scripts["db:migrate:rollback"],
|
|
24
26
|
"knex --knexfile ./knexfile.js migrate:rollback"
|
|
25
27
|
);
|
|
26
|
-
assert.deepEqual(
|
|
28
|
+
assert.deepEqual(packageMetadata.ci.steps, [
|
|
27
29
|
{
|
|
28
30
|
id: "database-migrations",
|
|
29
31
|
phase: "before-verify",
|
|
@@ -35,7 +37,7 @@ test("database-runtime db migrate scripts sync JSKIT-managed migrations before K
|
|
|
35
37
|
|
|
36
38
|
test("database-runtime runs deferred constraints after all ordinary migrations", async () => {
|
|
37
39
|
const knexfile = await readFile(path.join(PACKAGE_ROOT, "templates/knexfile.js"), "utf8");
|
|
38
|
-
const deferredDirectoryMutation =
|
|
40
|
+
const deferredDirectoryMutation = packageMetadata.mutations.files.find(
|
|
39
41
|
(mutation) => mutation.id === "database-runtime-constraint-migrations-dir"
|
|
40
42
|
);
|
|
41
43
|
|
package/package.descriptor.mjs
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
export default Object.freeze({
|
|
2
|
-
packageVersion: 1,
|
|
3
|
-
packageId: "@jskit-ai/database-runtime",
|
|
4
|
-
version: "0.1.148",
|
|
5
|
-
kind: "runtime",
|
|
6
|
-
dependsOn: [
|
|
7
|
-
"@jskit-ai/kernel"
|
|
8
|
-
],
|
|
9
|
-
capabilities: {
|
|
10
|
-
provides: [
|
|
11
|
-
"runtime.database"
|
|
12
|
-
],
|
|
13
|
-
requires: [
|
|
14
|
-
"runtime.database.driver"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
runtime: {
|
|
18
|
-
server: {
|
|
19
|
-
providerEntrypoint: "src/server/providers/DatabaseRuntimeServiceProvider.js",
|
|
20
|
-
providers: [
|
|
21
|
-
{
|
|
22
|
-
entrypoint: "src/server/providers/DatabaseRuntimeServiceProvider.js",
|
|
23
|
-
export: "DatabaseRuntimeServiceProvider"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
client: {
|
|
28
|
-
providers: []
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
metadata: {
|
|
32
|
-
apiSummary: {
|
|
33
|
-
surfaces: [
|
|
34
|
-
{
|
|
35
|
-
subpath: "./server",
|
|
36
|
-
summary: "Exports DatabaseRuntimeServiceProvider plus registerDatabaseRuntime for server container wiring."
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
subpath: "./shared",
|
|
40
|
-
summary: "Exports shared Knex runtime utilities (transaction manager, repository helpers, retention/json/date/dialect helpers)."
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
subpath: "./client",
|
|
44
|
-
summary: "Exports no runtime API today (reserved client entrypoint)."
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
containerTokens: {
|
|
48
|
-
server: [
|
|
49
|
-
"runtime.database",
|
|
50
|
-
"runtime.database.driver",
|
|
51
|
-
"jskit.database.knex",
|
|
52
|
-
"jskit.database.transactionManager"
|
|
53
|
-
],
|
|
54
|
-
client: []
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
ci: {
|
|
59
|
-
environment: {},
|
|
60
|
-
services: [],
|
|
61
|
-
steps: [
|
|
62
|
-
{
|
|
63
|
-
id: "database-migrations",
|
|
64
|
-
phase: "before-verify",
|
|
65
|
-
label: "Apply database migrations",
|
|
66
|
-
command: "npm run db:migrate"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
mutations: {
|
|
71
|
-
dependencies: {
|
|
72
|
-
runtime: {
|
|
73
|
-
"@jskit-ai/kernel": "0.1.147",
|
|
74
|
-
"dotenv": "^16.4.5",
|
|
75
|
-
"knex": "^3.1.0"
|
|
76
|
-
},
|
|
77
|
-
dev: {}
|
|
78
|
-
},
|
|
79
|
-
packageJson: {
|
|
80
|
-
scripts: {
|
|
81
|
-
"db:migrations:sync": "jskit migrations changed",
|
|
82
|
-
"db:migrate": "npm run db:migrations:sync && knex --knexfile ./knexfile.js migrate:latest",
|
|
83
|
-
"db:migrate:rollback": "knex --knexfile ./knexfile.js migrate:rollback",
|
|
84
|
-
"db:migrate:status": "npm run db:migrations:sync && knex --knexfile ./knexfile.js migrate:list"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
procfile: {},
|
|
88
|
-
files: [
|
|
89
|
-
{
|
|
90
|
-
from: "templates/knexfile.js",
|
|
91
|
-
to: "knexfile.js",
|
|
92
|
-
reason: "Install root Knex configuration so app scripts can run migrations through Knex CLI.",
|
|
93
|
-
category: "database-runtime",
|
|
94
|
-
id: "database-runtime-knexfile"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
from: "templates/migrations/.gitkeep",
|
|
98
|
-
to: "migrations/.gitkeep",
|
|
99
|
-
reason: "Ensure migrations directory exists so Knex migration commands can run before any module installs migrations.",
|
|
100
|
-
category: "database-runtime",
|
|
101
|
-
id: "database-runtime-migrations-dir"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
from: "templates/migrations/constraints/.gitkeep",
|
|
105
|
-
to: "migrations/constraints/.gitkeep",
|
|
106
|
-
reason: "Ensure the ordered deferred-constraint migration directory exists.",
|
|
107
|
-
category: "database-runtime",
|
|
108
|
-
id: "database-runtime-constraint-migrations-dir"
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
});
|