@arkstack/cache 0.13.2 → 0.14.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.
@@ -20,8 +20,9 @@ var Store = class {};
20
20
  * `@arkstack/database`.
21
21
  *
22
22
  * The table is expected to have `key` (string, primary), `value` (text), and
23
- * `expiration` (nullable integer epoch seconds) columns. `@arkstack/database`
24
- * is an optional peer dependency and is imported lazily.
23
+ * `expiration` (nullable integer epoch seconds) columns. Run
24
+ * `ark publish --tag cache-migrations` to add the migration that creates it.
25
+ * `@arkstack/database` is an optional peer dependency and is imported lazily.
25
26
  */
26
27
  var DatabaseStore = class extends Store {
27
28
  databaseConfig;
@@ -1,4 +1,4 @@
1
- import { t as Cache } from "../CacheManager-DfAiI5Ft.js";
1
+ import { t as Cache } from "../CacheManager-Do82q7KO.js";
2
2
  import { Command } from "@h3ravel/musket";
3
3
  //#region src/commands/CacheClearCommand.ts
4
4
  /**
package/dist/index.d.ts CHANGED
@@ -501,8 +501,9 @@ declare class RedisStore extends Store {
501
501
  * `@arkstack/database`.
502
502
  *
503
503
  * The table is expected to have `key` (string, primary), `value` (text), and
504
- * `expiration` (nullable integer epoch seconds) columns. `@arkstack/database`
505
- * is an optional peer dependency and is imported lazily.
504
+ * `expiration` (nullable integer epoch seconds) columns. Run
505
+ * `ark publish --tag cache-migrations` to add the migration that creates it.
506
+ * `@arkstack/database` is an optional peer dependency and is imported lazily.
506
507
  */
507
508
  declare class DatabaseStore extends Store {
508
509
  private readonly databaseConfig;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as RedisStore, c as DatabaseStore, i as ttlToSeconds, l as Store, n as configure, o as MemoryStore, r as Repository, s as FileStore, t as Cache } from "./CacheManager-DfAiI5Ft.js";
1
+ import { a as RedisStore, c as DatabaseStore, i as ttlToSeconds, l as Store, n as configure, o as MemoryStore, r as Repository, s as FileStore, t as Cache } from "./CacheManager-Do82q7KO.js";
2
2
  export { Cache, DatabaseStore, FileStore, MemoryStore, RedisStore, Repository, Store, configure, ttlToSeconds };
@@ -0,0 +1 @@
1
+ export { };
package/dist/setup.js ADDED
@@ -0,0 +1,21 @@
1
+ import { dirname, join } from "node:path";
2
+ import { Publisher } from "@arkstack/common";
3
+ import { fileURLToPath } from "node:url";
4
+ //#region src/setup.ts
5
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
6
+ /**
7
+ * Register the artifacts `@arkstack/cache` publishes into the application.
8
+ *
9
+ * Run `ark publish --package @arkstack/cache` (or `--tag cache-migrations`) to
10
+ * copy the migration for the `database` cache store into the app.
11
+ */
12
+ Publisher.publishes({
13
+ package: "@arkstack/cache",
14
+ tag: "cache-migrations",
15
+ entries: [{
16
+ from: join(root, "stubs/migrations/20260601000000_create_cache_table.ts.stub"),
17
+ to: "src/database/migrations/20260601000000_create_cache_table.ts"
18
+ }]
19
+ });
20
+ //#endregion
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/cache",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "description": "Cache module for Arkstack, providing a unified, driver based caching layer for the framework.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/cache",
@@ -20,7 +20,8 @@
20
20
  "arkstack"
21
21
  ],
22
22
  "files": [
23
- "dist"
23
+ "dist",
24
+ "stubs"
24
25
  ],
25
26
  "publishConfig": {
26
27
  "access": "public"
@@ -28,16 +29,17 @@
28
29
  "exports": {
29
30
  ".": "./dist/index.js",
30
31
  "./commands/CacheClearCommand": "./dist/commands/CacheClearCommand.js",
32
+ "./setup": "./dist/setup.js",
31
33
  "./package.json": "./package.json"
32
34
  },
33
35
  "dependencies": {
34
- "@arkstack/common": "^0.13.2"
36
+ "@arkstack/common": "^0.14.0"
35
37
  },
36
38
  "peerDependencies": {
37
39
  "@h3ravel/musket": "^2.2.0",
38
40
  "ioredis": "^5.4.1",
39
- "@arkstack/contract": "^0.13.2",
40
- "@arkstack/database": "^0.13.2"
41
+ "@arkstack/contract": "^0.14.0",
42
+ "@arkstack/database": "^0.14.0"
41
43
  },
42
44
  "peerDependenciesMeta": {
43
45
  "@arkstack/database": {
@@ -0,0 +1,21 @@
1
+ import { Migration, SchemaBuilder } from 'arkormx'
2
+
3
+ /**
4
+ * Backing table for the `database` cache store (`@arkstack/cache`).
5
+ *
6
+ * Columns: `key` (string primary), `value` (text), `expiration` (nullable
7
+ * epoch seconds). Adjust the table name to match `cache.stores.database.table`.
8
+ */
9
+ export default class CreateCacheTableMigration extends Migration {
10
+ public async up (schema: SchemaBuilder): Promise<void> {
11
+ schema.createTable('cache', (table) => {
12
+ table.string('key').primary()
13
+ table.text('value')
14
+ table.integer('expiration').nullable()
15
+ })
16
+ }
17
+
18
+ public async down (schema: SchemaBuilder): Promise<void> {
19
+ schema.dropTable('cache')
20
+ }
21
+ }