@f0rbit/corpus 0.1.0 → 0.1.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/dist/backend/file.js +2 -2
- package/dist/cloudflare.d.ts +15 -0
- package/dist/cloudflare.d.ts.map +1 -0
- package/dist/cloudflare.js +13 -0
- package/dist/codec.d.ts +5 -2
- package/dist/codec.d.ts.map +1 -1
- package/package.json +5 -1
package/dist/backend/file.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ok, err } from '../types';
|
|
2
|
-
import { mkdir,
|
|
2
|
+
import { mkdir, readdir } from 'node:fs/promises';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
4
|
export function create_file_backend(config) {
|
|
5
5
|
const { base_path, on_event } = config;
|
|
@@ -166,7 +166,7 @@ export function create_file_backend(config) {
|
|
|
166
166
|
try {
|
|
167
167
|
const file = Bun.file(path);
|
|
168
168
|
if (await file.exists()) {
|
|
169
|
-
await
|
|
169
|
+
await file.delete();
|
|
170
170
|
}
|
|
171
171
|
return ok(undefined);
|
|
172
172
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Workers compatible exports
|
|
3
|
+
* This entry point excludes the file backend which uses Node.js APIs
|
|
4
|
+
*/
|
|
5
|
+
export { create_corpus } from './corpus';
|
|
6
|
+
export { create_store } from './store';
|
|
7
|
+
export { create_memory_backend, type MemoryBackendOptions } from './backend/memory';
|
|
8
|
+
export { create_cloudflare_backend, type CloudflareBackendConfig } from './backend/cloudflare';
|
|
9
|
+
export { json_codec, text_codec, binary_codec } from './codec';
|
|
10
|
+
export { corpus_snapshots, type CorpusSnapshotRow, type CorpusSnapshotInsert } from './schema';
|
|
11
|
+
export { compute_hash } from './hash';
|
|
12
|
+
export { generate_version } from './version';
|
|
13
|
+
export type { ContentType, ParentRef, SnapshotMeta, Snapshot, DataHandle, MetadataClient, DataClient, ListOpts, Backend, Codec, Store, StoreDefinition, PutOpts, CorpusBuilder, Corpus, CorpusError, Result, CorpusEvent, EventHandler, } from './types';
|
|
14
|
+
export { ok, err, define_store } from './types';
|
|
15
|
+
//# sourceMappingURL=cloudflare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../cloudflare.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAAE,yBAAyB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9F,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE9F,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAE5C,YAAY,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,cAAc,EACd,UAAU,EACV,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,EACL,eAAe,EACf,OAAO,EACP,aAAa,EACb,MAAM,EACN,WAAW,EACX,MAAM,EACN,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Workers compatible exports
|
|
3
|
+
* This entry point excludes the file backend which uses Node.js APIs
|
|
4
|
+
*/
|
|
5
|
+
export { create_corpus } from './corpus';
|
|
6
|
+
export { create_store } from './store';
|
|
7
|
+
export { create_memory_backend } from './backend/memory';
|
|
8
|
+
export { create_cloudflare_backend } from './backend/cloudflare';
|
|
9
|
+
export { json_codec, text_codec, binary_codec } from './codec';
|
|
10
|
+
export { corpus_snapshots } from './schema';
|
|
11
|
+
export { compute_hash } from './hash';
|
|
12
|
+
export { generate_version } from './version';
|
|
13
|
+
export { ok, err, define_store } from './types';
|
package/dist/codec.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { ZodSchema } from "zod";
|
|
2
1
|
import type { Codec } from "./types";
|
|
3
|
-
|
|
2
|
+
type ZodLike<T> = {
|
|
3
|
+
parse: (data: unknown) => T;
|
|
4
|
+
};
|
|
5
|
+
export declare function json_codec<T>(schema: ZodLike<T>): Codec<T>;
|
|
4
6
|
export declare function text_codec(): Codec<string>;
|
|
5
7
|
export declare function binary_codec(): Codec<Uint8Array>;
|
|
8
|
+
export {};
|
|
6
9
|
//# sourceMappingURL=codec.d.ts.map
|
package/dist/codec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,KAAK,OAAO,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,CAAA;CAAE,CAAC;AAElD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAM1D;AAED,wBAAgB,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC,CAM1C;AAED,wBAAgB,YAAY,IAAI,KAAK,CAAC,UAAU,CAAC,CAMhD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@f0rbit/corpus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A functional snapshotting library for TypeScript with versioned data storage, lineage tracking, and multiple backend support",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
13
|
},
|
|
14
|
+
"./cloudflare": {
|
|
15
|
+
"import": "./dist/cloudflare.js",
|
|
16
|
+
"types": "./dist/cloudflare.d.ts"
|
|
17
|
+
},
|
|
14
18
|
"./types": {
|
|
15
19
|
"import": "./dist/types.js",
|
|
16
20
|
"types": "./dist/types.d.ts"
|