@jini-ai/capability-providers 0.1.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.
Files changed (54) hide show
  1. package/LICENSE +201 -0
  2. package/dist/auth.d.ts +70 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +181 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/db.d.ts +75 -0
  7. package/dist/db.d.ts.map +1 -0
  8. package/dist/db.js +83 -0
  9. package/dist/db.js.map +1 -0
  10. package/dist/index.d.ts +22 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +22 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/payments.d.ts +98 -0
  15. package/dist/payments.d.ts.map +1 -0
  16. package/dist/payments.js +180 -0
  17. package/dist/payments.js.map +1 -0
  18. package/dist/realtime.d.ts +86 -0
  19. package/dist/realtime.d.ts.map +1 -0
  20. package/dist/realtime.js +147 -0
  21. package/dist/realtime.js.map +1 -0
  22. package/dist/storage.d.ts +70 -0
  23. package/dist/storage.d.ts.map +1 -0
  24. package/dist/storage.js +61 -0
  25. package/dist/storage.js.map +1 -0
  26. package/dist/tokens.d.ts +11 -0
  27. package/dist/tokens.d.ts.map +1 -0
  28. package/dist/tokens.js +18 -0
  29. package/dist/tokens.js.map +1 -0
  30. package/dist/unsafe-reference/auth.d.ts +22 -0
  31. package/dist/unsafe-reference/auth.d.ts.map +1 -0
  32. package/dist/unsafe-reference/auth.js +56 -0
  33. package/dist/unsafe-reference/auth.js.map +1 -0
  34. package/dist/unsafe-reference/db.d.ts +16 -0
  35. package/dist/unsafe-reference/db.d.ts.map +1 -0
  36. package/dist/unsafe-reference/db.js +49 -0
  37. package/dist/unsafe-reference/db.js.map +1 -0
  38. package/dist/unsafe-reference/index.d.ts +49 -0
  39. package/dist/unsafe-reference/index.d.ts.map +1 -0
  40. package/dist/unsafe-reference/index.js +49 -0
  41. package/dist/unsafe-reference/index.js.map +1 -0
  42. package/dist/unsafe-reference/payments.d.ts +17 -0
  43. package/dist/unsafe-reference/payments.d.ts.map +1 -0
  44. package/dist/unsafe-reference/payments.js +38 -0
  45. package/dist/unsafe-reference/payments.js.map +1 -0
  46. package/dist/unsafe-reference/realtime.d.ts +17 -0
  47. package/dist/unsafe-reference/realtime.d.ts.map +1 -0
  48. package/dist/unsafe-reference/realtime.js +34 -0
  49. package/dist/unsafe-reference/realtime.js.map +1 -0
  50. package/dist/unsafe-reference/storage.d.ts +16 -0
  51. package/dist/unsafe-reference/storage.d.ts.map +1 -0
  52. package/dist/unsafe-reference/storage.js +30 -0
  53. package/dist/unsafe-reference/storage.js.map +1 -0
  54. package/package.json +56 -0
@@ -0,0 +1,30 @@
1
+ /** Creates the in-memory reference `StorageProvider`. No persistence — state is lost on process exit. */
2
+ export function createInMemoryStorageProvider() {
3
+ const objects = new Map();
4
+ return {
5
+ async put(key, data, options = {}) {
6
+ const meta = {
7
+ key,
8
+ size: data.byteLength,
9
+ updatedAt: Date.now(),
10
+ ...(options.contentType !== undefined ? { contentType: options.contentType } : {}),
11
+ };
12
+ objects.set(key, { data: data.slice(), meta });
13
+ return meta;
14
+ },
15
+ async get(key) {
16
+ const entry = objects.get(key);
17
+ return entry ? entry.data.slice() : null;
18
+ },
19
+ async delete(key) {
20
+ objects.delete(key);
21
+ },
22
+ async list(prefix = '') {
23
+ return [...objects.values()]
24
+ .map((entry) => entry.meta)
25
+ .filter((meta) => meta.key.startsWith(prefix))
26
+ .sort((a, b) => a.key.localeCompare(b.key));
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/unsafe-reference/storage.ts"],"names":[],"mappings":"AAcA,yGAAyG;AACzG,MAAM,UAAU,6BAA6B;IAC3C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyD,CAAC;IAEjF,OAAO;QACL,KAAK,CAAC,GAAG,CAAC,GAAW,EA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,0 +1,56 @@
1
+ {
2
+ "name": "@jini-ai/capability-providers",
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/AINSEP/Jini.git",
8
+ "directory": "packages/capability-providers"
9
+ },
10
+ "jini": {
11
+ "domain": "capability",
12
+ "kind": "provider-adapters",
13
+ "runtime": "node",
14
+ "admission": "incubating"
15
+ },
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./unsafe-reference": {
23
+ "types": "./dist/unsafe-reference/index.d.ts",
24
+ "import": "./dist/unsafe-reference/index.js"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "!dist/**/*.test.js",
30
+ "!dist/**/*.test.d.ts",
31
+ "!dist/**/*.test.js.map",
32
+ "!dist/**/*.test.d.ts.map",
33
+ "!dist/**/__tests__/**"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "registry": "https://registry.npmjs.org"
38
+ },
39
+ "dependencies": {
40
+ "better-sqlite3": "^11.10.0",
41
+ "ws": "^8.18.0",
42
+ "@jini-ai/platform": "0.1.0",
43
+ "@jini-ai/core": "0.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/better-sqlite3": "^7.6.11",
47
+ "@types/ws": "^8.18.0",
48
+ "@vitest/coverage-v8": "^2.1.9"
49
+ },
50
+ "scripts": {
51
+ "build": "tsc -p tsconfig.json",
52
+ "typecheck": "tsc -p tsconfig.json --noEmit",
53
+ "test": "vitest run",
54
+ "test:coverage": "vitest run --coverage"
55
+ }
56
+ }