@onereach/state-machine-driver-fs 1.0.0-framework.2
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/README.md +3 -0
- package/dist/index.d.mts +48 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DocumentDriver, DriverCapabilities, DriverChange, DriverDeleteOptions, DriverLoadOptions, DriverLoadResult, DriverSaveOptions, DriverSaveResult, DriverWatchOptions, StateMachineInstanceDriver, StateMachineInstanceReference, StateTemplateDriver, StateTemplateReference } from "@onereach/state-machine-store";
|
|
2
|
+
//#region src/generic-driver/types.d.ts
|
|
3
|
+
interface JsonFileDriverOptions<TReference> {
|
|
4
|
+
path: (this: void, reference: TReference) => string;
|
|
5
|
+
lockTimeoutMs?: number;
|
|
6
|
+
staleLockMs?: number;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/generic-driver/generic-driver.d.ts
|
|
10
|
+
declare class JsonFileDriver<TReference> implements DocumentDriver<TReference> {
|
|
11
|
+
private readonly lockTimeoutMs;
|
|
12
|
+
private readonly staleLockMs;
|
|
13
|
+
private readonly options;
|
|
14
|
+
readonly capabilities: DriverCapabilities;
|
|
15
|
+
constructor(options: JsonFileDriverOptions<TReference>);
|
|
16
|
+
private readRaw;
|
|
17
|
+
private assertRevision;
|
|
18
|
+
private withLock;
|
|
19
|
+
load<TState = unknown>(reference: TReference, options?: DriverLoadOptions): Promise<DriverLoadResult<TState> | undefined>;
|
|
20
|
+
save<TState = unknown>(reference: TReference, value: TState, options?: DriverSaveOptions): Promise<DriverSaveResult>;
|
|
21
|
+
delete(reference: TReference, options?: DriverDeleteOptions): Promise<boolean>;
|
|
22
|
+
watch(reference: TReference, options?: DriverWatchOptions): AsyncIterable<DriverChange<TReference>>;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/state-instance-driver/types.d.ts
|
|
26
|
+
interface FileStateMachineInstanceDriverOptions {
|
|
27
|
+
root: string;
|
|
28
|
+
path?: (this: void, reference: StateMachineInstanceReference) => string;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/state-instance-driver/state-instance-driver.d.ts
|
|
32
|
+
declare class FileStateMachineInstanceDriver extends JsonFileDriver<StateMachineInstanceReference> implements StateMachineInstanceDriver {
|
|
33
|
+
constructor(options: FileStateMachineInstanceDriverOptions);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/state-template-driver/types.d.ts
|
|
37
|
+
interface FileStateTemplateDriverOptions {
|
|
38
|
+
root: string;
|
|
39
|
+
path?(this: void, reference: StateTemplateReference): string;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/state-template-driver/state-template-driver.d.ts
|
|
43
|
+
declare class FileStateTemplateDriver extends JsonFileDriver<StateTemplateReference> implements StateTemplateDriver {
|
|
44
|
+
constructor(options: FileStateTemplateDriverOptions);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { FileStateMachineInstanceDriver, type FileStateMachineInstanceDriverOptions, FileStateTemplateDriver, type FileStateTemplateDriverOptions, JsonFileDriver, type JsonFileDriverOptions };
|
|
48
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/generic-driver/types.ts","../src/generic-driver/generic-driver.ts","../src/state-instance-driver/types.ts","../src/state-instance-driver/state-instance-driver.ts","../src/state-template-driver/types.ts","../src/state-template-driver/state-template-driver.ts"],"mappings":";;UAAiB,sBAAsB;EACrC,OAAO,YAAY,WAAW;EAC9B;EACA;;;;cCkBW,eAAe,uBAAuB,eAAe;mBAC/C;mBACA;mBACA;WAED,cAAc;EAKlB,YAAA,SAAS,sBAAsB;UAM7B;UAmBN;UAuBM;EAuDD,KAAK,kBAChB,WAAW,YACX,UAAU,oBACT,QAAQ,iBAAiB;EAkBf,KAAK,kBAChB,WAAW,YACX,OAAO,QACP,UAAS,oBACR,QAAQ;EA4CE,OAAO,WAAW,YAAY,UAAS,sBAA2B;EAwBjE,MACZ,WAAW,YACX,UAAS,qBACR,cAAc,aAAa;;;;UCpOf;EACf;EACA,QAAQ,YAAY,WAAW;;;;cCIpB,uCACH,eAAe,0CACZ;EAEC,YAAA,SAAS;;;;UCVN;EACf;EACA,MAAM,YAAY,WAAW;;;;cCIlB,gCAAgC,eAAe,mCAAmC;EACjF,YAAA,SAAS"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{RevisionConflictError as e}from"@onereach/state-machine-store";import{createHash as t,randomUUID as n}from"node:crypto";import{mkdir as r,open as i,readFile as a,rename as o,stat as s,unlink as c,watch as l,writeFile as u}from"node:fs/promises";import d from"node:path";import{setTimeout as f}from"node:timers/promises";function p(e){return JSON.stringify(e,void 0,2)+`
|
|
2
|
+
`}function m(e){return`sha256:`+t(`sha256`).update(e).digest(`hex`)}function h(e){return encodeURIComponent(e).replaceAll(`.`,`%2E`)}function g(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}function _(e){if(e?.aborted)throw e.reason??new DOMException(`Aborted`,`AbortError`)}var v=class{lockTimeoutMs;staleLockMs;options;capabilities={concurrency:`cooperative-lock`,watch:`push`};constructor(e){this.options=e,this.lockTimeoutMs=e.lockTimeoutMs??5e3,this.staleLockMs=e.staleLockMs??3e4}async readRaw(e){try{let t=await a(e,`utf8`);return{text:t,revision:m(t)}}catch(e){if(g(e,`ENOENT`))return;throw e}}assertRevision(t,n){if(n!==void 0){if(n===null){if(t!==void 0)throw new e(null,t);return}if(t!==n)throw new e(n,t)}}async withLock(e,t,n){let r=`${e}.lock`,a=Date.now(),o;for(;!o;){_(t);try{o=await i(r,`wx`);let e=new Date;await o.writeFile(JSON.stringify({pid:process.pid,createdAt:e.toISOString()}))}catch(e){if(!g(e,`EEXIST`))throw e;try{let e=await s(r);if(Date.now()-e.mtimeMs>this.staleLockMs){await c(r);continue}}catch{continue}if(Date.now()-a>this.lockTimeoutMs)throw Error(`Timed out waiting for lock: ${r}`,{cause:e});await f(25,void 0,{signal:t})}}try{return await n()}finally{await o.close().catch(()=>{}),await c(r).catch(()=>{})}}async load(e,t){_(t?.signal);let n=this.options.path(e),r=await this.readRaw(n);if(r)return{value:JSON.parse(r.text),revision:r.revision,metadata:{driver:`fs`,path:n}}}async save(e,t,i={}){_(i.signal);let a=this.options.path(e);return await r(d.dirname(a),{recursive:!0}),await this.withLock(a,i.signal,async()=>{let e=await this.readRaw(a);this.assertRevision(e?.revision,i.expectedRevision);let r=p(t),s=m(r),l=`${a}.${n()}.tmp`;try{await u(l,r,{encoding:`utf8`,flag:`wx`}),await o(l,a)}catch(e){throw await c(l).catch(()=>{}),e}return{revision:s,metadata:{driver:`fs`,path:a}}})}async delete(t,n={}){_(n.signal);let r=this.options.path(t);return await this.withLock(r,n.signal,async()=>{let t=await this.readRaw(r);if(!t){if(typeof n.expectedRevision==`string`)throw new e(n.expectedRevision,void 0);return!1}return this.assertRevision(t.revision,n.expectedRevision),await c(r),!0})}async*watch(e,t={}){let n=this.options.path(e),i=d.dirname(n),a=d.basename(n);await r(i,{recursive:!0});let o=await this.readRaw(n);try{let r=l(i,{signal:t.signal});for await(let t of r){if(t.filename&&t.filename!==a)continue;await f(10);let r=await this.readRaw(n);if(!o&&r){o=r,yield{type:`created`,ref:e,revision:r.revision};continue}if(o&&!r){o=void 0,yield{type:`deleted`,ref:e};continue}o&&r&&o.revision!==r.revision&&(o=r,yield{type:`updated`,ref:e,revision:r.revision})}}catch(e){if(t.signal?.aborted)return;throw e}}},y=class extends v{constructor(e){super({path:e.path??(t=>d.join(e.root,`instances`,`${h(t.id)}.json`))})}},b=class extends v{constructor(e){super({path:e.path??(t=>d.join(e.root,`templates`,h(t.id),`${h(t.version??`latest`)}.json`))})}};export{y as FileStateMachineInstanceDriver,b as FileStateTemplateDriver,v as JsonFileDriver};
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["delay","fsWatch"],"sources":["../src/helpers.ts","../src/generic-driver/generic-driver.ts","../src/state-instance-driver/state-instance-driver.ts","../src/state-template-driver/state-template-driver.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\n\nexport function serializeJson(value: unknown): string {\n return JSON.stringify(value, undefined, 2) + '\\n';\n}\n\nexport function hash(value: string): string {\n return 'sha256:' + createHash('sha256').update(value).digest('hex');\n}\n\nexport function safeSegment(value: string): string {\n /**\n * encodeURIComponent does not encode \".\" so encode those\n * as well to avoid \".\" and \"..\" path traversal.\n */\n return encodeURIComponent(value).replaceAll('.', '%2E');\n}\n\nexport function isErrno(error: unknown, code: string): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n (\n error as {\n code?: unknown;\n }\n ).code === code\n );\n}\n\nexport function throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) {\n throw signal.reason ?? new DOMException('Aborted', 'AbortError');\n }\n}\n","import type {\n DocumentDriver,\n DriverCapabilities,\n DriverChange,\n DriverDeleteOptions,\n DriverLoadOptions,\n DriverLoadResult,\n DriverSaveOptions,\n DriverSaveResult,\n DriverWatchOptions,\n} from '@onereach/state-machine-store';\nimport { RevisionConflictError } from '@onereach/state-machine-store';\nimport { randomUUID } from 'node:crypto';\nimport { mkdir, open, readFile, rename, stat, unlink, watch as fsWatch, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { setTimeout as delay } from 'node:timers/promises';\n\nimport { hash, isErrno, serializeJson, throwIfAborted } from '../helpers.ts';\n\nimport type { JsonFileDriverOptions } from './types.ts';\n\nexport class JsonFileDriver<TReference> implements DocumentDriver<TReference> {\n private readonly lockTimeoutMs: number;\n private readonly staleLockMs: number;\n private readonly options: JsonFileDriverOptions<TReference>;\n\n public readonly capabilities: DriverCapabilities = {\n concurrency: 'cooperative-lock',\n watch: 'push',\n };\n\n constructor(options: JsonFileDriverOptions<TReference>) {\n this.options = options;\n this.lockTimeoutMs = options.lockTimeoutMs ?? 5000;\n this.staleLockMs = options.staleLockMs ?? 30_000;\n }\n\n private async readRaw(path: string): Promise<\n | undefined\n | {\n text: string;\n revision: string;\n }\n > {\n try {\n const text = await readFile(path, 'utf8');\n return {\n text,\n revision: hash(text),\n };\n } catch (error) {\n if (isErrno(error, 'ENOENT')) return undefined;\n throw error;\n }\n }\n\n private assertRevision(actual: string | undefined, expected: string | null | undefined): void {\n /**\n * No condition.\n */\n if (expected === undefined) return;\n\n /**\n * null means \"must not exist\".\n */\n if (expected === null) {\n if (actual !== undefined) {\n // eslint-disable-next-line unicorn/no-null\n throw new RevisionConflictError(null, actual);\n }\n\n return;\n }\n\n if (actual !== expected) {\n throw new RevisionConflictError(expected, actual);\n }\n }\n\n private async withLock<T>(path: string, signal: AbortSignal | undefined, callback: () => Promise<T>): Promise<T> {\n const lockPath = `${path}.lock`;\n const started = Date.now();\n\n let handle: Awaited<ReturnType<typeof open>> | undefined;\n\n while (!handle) {\n throwIfAborted(signal);\n\n try {\n handle = await open(lockPath, 'wx');\n\n const now = new Date();\n await handle.writeFile(\n JSON.stringify({\n pid: process.pid,\n createdAt: now.toISOString(),\n }),\n );\n } catch (error) {\n if (!isErrno(error, 'EEXIST')) throw error;\n\n /**\n * Recover from a process dying while holding\n * the cooperative lock.\n */\n try {\n const info = await stat(lockPath);\n\n if (Date.now() - info.mtimeMs > this.staleLockMs) {\n await unlink(lockPath);\n continue;\n }\n } catch {\n continue;\n }\n\n if (Date.now() - started > this.lockTimeoutMs) {\n throw new Error(`Timed out waiting for lock: ${lockPath}`, { cause: error });\n }\n\n await delay(25, undefined, { signal });\n }\n }\n\n try {\n return await callback();\n } finally {\n // eslint-disable-next-line unicorn/prefer-await\n await handle.close().catch(() => {});\n // eslint-disable-next-line unicorn/prefer-await\n await unlink(lockPath).catch(() => {});\n }\n }\n\n public async load<TState = unknown>(\n reference: TReference,\n options?: DriverLoadOptions,\n ): Promise<DriverLoadResult<TState> | undefined> {\n throwIfAborted(options?.signal);\n\n const entityPath = this.options.path(reference);\n const raw = await this.readRaw(entityPath);\n\n if (!raw) return undefined;\n\n return {\n value: JSON.parse(raw.text) as TState,\n revision: raw.revision,\n metadata: {\n driver: 'fs',\n path: entityPath,\n },\n };\n }\n\n public async save<TState = unknown>(\n reference: TReference,\n value: TState,\n options: DriverSaveOptions = {},\n ): Promise<DriverSaveResult> {\n throwIfAborted(options.signal);\n\n const entityPath = this.options.path(reference);\n\n await mkdir(path.dirname(entityPath), { recursive: true });\n\n return await this.withLock(entityPath, options.signal, async () => {\n const current = await this.readRaw(entityPath);\n\n this.assertRevision(current?.revision, options.expectedRevision);\n\n const text = serializeJson(value);\n const revision = hash(text);\n const temporaryPath = `${entityPath}.${randomUUID()}.tmp`;\n\n try {\n await writeFile(temporaryPath, text, {\n encoding: 'utf8',\n flag: 'wx',\n });\n\n /**\n * POSIX rename gives us atomic replacement.\n */\n await rename(temporaryPath, entityPath);\n } catch (error) {\n // eslint-disable-next-line unicorn/prefer-await\n await unlink(temporaryPath).catch(() => {});\n\n throw error;\n }\n\n return {\n revision,\n\n metadata: {\n driver: 'fs',\n path: entityPath,\n },\n };\n });\n }\n\n public async delete(reference: TReference, options: DriverDeleteOptions = {}): Promise<boolean> {\n throwIfAborted(options.signal);\n\n const entityPath = this.options.path(reference);\n\n return await this.withLock(entityPath, options.signal, async () => {\n const current = await this.readRaw(entityPath);\n\n if (!current) {\n if (typeof options.expectedRevision === 'string') {\n throw new RevisionConflictError(options.expectedRevision, undefined);\n }\n\n return false;\n }\n\n this.assertRevision(current.revision, options.expectedRevision);\n\n await unlink(entityPath);\n\n return true;\n });\n }\n\n public async *watch(\n reference: TReference,\n options: DriverWatchOptions = {},\n ): AsyncIterable<DriverChange<TReference>> {\n const entityPath = this.options.path(reference);\n const directory = path.dirname(entityPath);\n const target = path.basename(entityPath);\n\n /**\n * Make it possible to watch before the object exists.\n */\n await mkdir(directory, { recursive: true });\n\n let previous = await this.readRaw(entityPath);\n\n try {\n const eventsIterable = fsWatch(directory, { signal: options.signal });\n for await (const event of eventsIterable) {\n if (event.filename && event.filename !== target) continue;\n\n /**\n * Coalesce rapid rename/change events.\n */\n await delay(10);\n\n const current = await this.readRaw(entityPath);\n\n if (!previous && current) {\n previous = current;\n\n yield {\n type: 'created',\n ref: reference,\n revision: current.revision,\n };\n\n continue;\n }\n\n if (previous && !current) {\n previous = undefined;\n\n yield {\n type: 'deleted',\n ref: reference,\n };\n\n continue;\n }\n\n if (previous && current && previous.revision !== current.revision) {\n previous = current;\n\n yield {\n type: 'updated',\n ref: reference,\n revision: current.revision,\n };\n }\n }\n } catch (error) {\n if (options.signal?.aborted) return;\n\n throw error;\n }\n }\n}\n","import type { StateMachineInstanceDriver, StateMachineInstanceReference } from '@onereach/state-machine-store';\nimport path from 'node:path';\n\nimport { JsonFileDriver } from '../generic-driver/generic-driver.ts';\nimport { safeSegment } from '../helpers.ts';\n\nimport { FileStateMachineInstanceDriverOptions } from './types.ts';\n\nexport class FileStateMachineInstanceDriver\n extends JsonFileDriver<StateMachineInstanceReference>\n implements StateMachineInstanceDriver\n{\n constructor(options: FileStateMachineInstanceDriverOptions) {\n super({\n path: options.path ?? ((reference) => path.join(options.root, 'instances', `${safeSegment(reference.id)}.json`)),\n });\n }\n}\n","import type { StateTemplateDriver, StateTemplateReference } from '@onereach/state-machine-store';\nimport path from 'node:path';\n\nimport { JsonFileDriver } from '../generic-driver/generic-driver.ts';\nimport { safeSegment } from '../helpers.ts';\n\nimport { FileStateTemplateDriverOptions } from './types.ts';\n\nexport class FileStateTemplateDriver extends JsonFileDriver<StateTemplateReference> implements StateTemplateDriver {\n constructor(options: FileStateTemplateDriverOptions) {\n super({\n path:\n options.path ??\n ((reference) =>\n path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AK,QAAQ,CAAU,EAE5C,GAAI,CACF,IAAM,EAAiBC,EAAQ,EAAW,CAAE,OAAQ,EAAQ,MAAO,CAAC,EACpE,UAAW,IAAM,KAAS,EAAgB,CACxC,GAAI,EAAM,UAAY,EAAM,WAAa,EAAQ,SAKjD,MAAMD,EAAM,EAAE,EAEd,IAAM,EAAU,MAAM,KAAK,QAAQ,CAAU,EAE7C,GAAI,CAAC,GAAY,EAAS,CACxB,EAAW,EAEX,KAAM,CACJ,KAAM,UACN,IAAK,EACL,SAAU,EAAQ,QACpB,EAEA,QACF,CAEA,GAAI,GAAY,CAAC,EAAS,CACxB,EAAW,IAAA,GAEX,KAAM,CACJ,KAAM,UACN,IAAK,CACP,EAEA,QACF,CAEI,GAAY,GAAW,EAAS,WAAa,EAAQ,WACvD,EAAW,EAEX,KAAM,CACJ,KAAM,UACN,IAAK,EACL,SAAU,EAAQ,QACpB,EAEJ,CACF,OAAS,EAAO,CACd,GAAI,EAAQ,QAAQ,QAAS,OAE7B,MAAM,CACR,CACF,CACF,EC7Ra,EAAb,cACU,CAEV,CACE,YAAY,EAAgD,CAC1D,MAAM,CACJ,KAAM,EAAQ,OAAU,GAAc,EAAK,KAAK,EAAQ,KAAM,YAAa,GAAG,EAAY,EAAU,EAAE,EAAE,MAAM,EAChH,CAAC,CACH,CACF,ECTa,EAAb,cAA6C,CAAsE,CACjH,YAAY,EAAyC,CACnD,MAAM,CACJ,KACE,EAAQ,OACN,GACA,EAAK,KACH,EAAQ,KACR,YACA,EAAY,EAAU,EAAE,EACxB,GAAG,EAAY,EAAU,SAAW,QAAQ,EAAE,MAChD,EACN,CAAC,CACH,CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@onereach/state-machine-driver-fs",
|
|
3
|
+
"version": "1.0.0-framework.2",
|
|
4
|
+
"description": "State Machine filesystem driver",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"onereach",
|
|
7
|
+
"toolkit",
|
|
8
|
+
"state-machine"
|
|
9
|
+
],
|
|
10
|
+
"author": "OneReach Development Team <dev.team@onereach.ai>",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"!dist/metafile*.json"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@arethetypeswrong/core": "^0.18.5",
|
|
22
|
+
"@onereach/state-machine-test-utils": "1.0.0-framework.2",
|
|
23
|
+
"@types/source-map-support": "^0.5.10",
|
|
24
|
+
"publint": "^0.3.24",
|
|
25
|
+
"rollup-plugin-visualizer": "^7.1.1",
|
|
26
|
+
"tsdown": "^0.22.14",
|
|
27
|
+
"typescript": "^6.0.3"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@onereach/state-machine-store": "1.0.0-framework.2"
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": "./dist/index.mjs",
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsdown --config tsdown.config.mts",
|
|
38
|
+
"build:visualize": "VISUALIZE=1 pnpm build",
|
|
39
|
+
"preversion_": "pnpm build && pnpm test",
|
|
40
|
+
"publish:rc": "pnpm version prerelease --preid rc && pnpm publish --tag rc",
|
|
41
|
+
"test": "pnpm run unit",
|
|
42
|
+
"unit": "vitest run",
|
|
43
|
+
"preversion": "pnpm build"
|
|
44
|
+
}
|
|
45
|
+
}
|