@xyo-network/archivist-firebase 5.3.22 → 5.3.24

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": "@xyo-network/archivist-firebase",
3
- "version": "5.3.22",
3
+ "version": "5.3.24",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,48 +30,41 @@
30
30
  "types": "dist/browser/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src",
34
33
  "!**/*.bench.*",
35
34
  "!**/*.spec.*",
36
35
  "!**/*.test.*",
37
36
  "README.md"
38
37
  ],
39
38
  "dependencies": {
40
- "@xyo-network/archivist-abstract": "~5.3.22",
41
- "@xyo-network/archivist-model": "~5.3.22",
42
- "@xyo-network/module-model": "~5.3.22",
43
- "@xyo-network/payload-model": "~5.3.22"
39
+ "@xyo-network/archivist-abstract": "~5.3.24",
40
+ "@xyo-network/archivist-model": "~5.3.24",
41
+ "@xyo-network/module-model": "~5.3.24",
42
+ "@xyo-network/payload-model": "~5.3.24"
44
43
  },
45
44
  "devDependencies": {
46
45
  "@firebase/app": "~0.14.10",
47
- "@firebase/app-compat": "^0.5.10",
48
- "@firebase/app-types": "^0.9.3",
49
46
  "@firebase/firestore": "~4.13.0",
50
47
  "@firebase/rules-unit-testing": "~5.0.0",
51
- "@firebase/util": "^1.15.0",
52
48
  "@opentelemetry/api": "^1.9.1",
53
49
  "@types/node": "^25.5.0",
54
- "@xylabs/sdk-js": "^5.0.91",
55
- "@xylabs/ts-scripts-common": "~7.6.8",
56
- "@xylabs/ts-scripts-yarn3": "~7.6.8",
57
- "@xylabs/tsconfig": "~7.6.8",
58
- "@xyo-network/archivist-abstract": "~5.3.22",
59
- "@xyo-network/archivist-model": "~5.3.22",
60
- "@xyo-network/module-model": "~5.3.22",
61
- "@xyo-network/payload-model": "~5.3.22",
50
+ "@xylabs/sdk-js": "^5.0.93",
51
+ "@xylabs/ts-scripts-common": "~7.6.16",
52
+ "@xylabs/ts-scripts-pnpm": "~7.6.16",
53
+ "@xylabs/tsconfig": "~7.6.16",
62
54
  "acorn": "^8.16.0",
63
55
  "axios": "^1.14.0",
64
- "cosmiconfig": "^9.0.1",
65
- "esbuild": "^0.27.4",
66
- "eslint": "^10.1.0",
56
+ "esbuild": "^0.28.0",
67
57
  "ethers": "^6.16.0",
68
58
  "firebase": "~12.11.0",
69
- "rollup": "^4.60.1",
70
59
  "tslib": "^2.8.1",
71
60
  "typescript": "~5.9.3",
72
61
  "vite": "^8.0.3",
73
62
  "vitest": "~4.1.2",
74
- "zod": "^4.3.6"
63
+ "zod": "^4.3.6",
64
+ "@xyo-network/archivist-abstract": "~5.3.24",
65
+ "@xyo-network/archivist-model": "~5.3.24",
66
+ "@xyo-network/module-model": "~5.3.24",
67
+ "@xyo-network/payload-model": "~5.3.24"
75
68
  },
76
69
  "peerDependencies": {
77
70
  "@firebase/app": "~0.14",
@@ -84,4 +77,4 @@
84
77
  "publishConfig": {
85
78
  "access": "public"
86
79
  }
87
- }
80
+ }
package/src/Archivist.ts DELETED
@@ -1,71 +0,0 @@
1
- import {
2
- collection,
3
- doc,
4
- getDoc,
5
- getFirestore,
6
- setDoc,
7
- } from '@firebase/firestore'
8
- import {
9
- assertEx, exists, Hash,
10
- } from '@xylabs/sdk-js'
11
- import { AbstractArchivist, StorageClassLabel } from '@xyo-network/archivist-abstract'
12
- import { ArchivistInsertQuerySchema, ArchivistModuleEventData } from '@xyo-network/archivist-model'
13
- import { creatableModule } from '@xyo-network/module-model'
14
- import {
15
- Payload, Schema, WithStorageMeta,
16
- } from '@xyo-network/payload-model'
17
-
18
- import { FirebaseArchivistConfigSchema } from './Config.ts'
19
- import { FirebaseArchivistParams } from './Params.ts'
20
-
21
- @creatableModule()
22
- export class FirebaseArchivist<
23
- TParams extends FirebaseArchivistParams = FirebaseArchivistParams,
24
- TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,
25
- > extends AbstractArchivist<TParams, TEventData> {
26
- static override readonly configSchemas: Schema[] = [...super.configSchemas, FirebaseArchivistConfigSchema]
27
- static override readonly defaultConfigSchema: Schema = FirebaseArchivistConfigSchema
28
- static override readonly labels = { ...super.labels, [StorageClassLabel]: 'network' }
29
-
30
- override get queries() {
31
- return [
32
- ArchivistInsertQuerySchema,
33
- ...super.queries,
34
- ]
35
- }
36
-
37
- private get collection() {
38
- return collection(this.firestore, assertEx(this.config.collection, () => 'Missing collection name'))
39
- }
40
-
41
- private get firebaseApp() {
42
- return assertEx(this.params.firebaseApp, () => 'Missing FirebaseApp')
43
- }
44
-
45
- private get firestore() {
46
- return getFirestore(this.firebaseApp, assertEx(this.config.dbId, () => 'no dbId specified'))
47
- }
48
-
49
- protected override async getHandler(hashes: Hash[]): Promise<WithStorageMeta<Payload>[]> {
50
- const payloadCollection = this.collection
51
- return (await Promise.all(hashes.map(async (hash) => {
52
- const docRef = doc(payloadCollection, hash)
53
- const docSnap = await getDoc(docRef)
54
- if (!docSnap.exists()) {
55
- return null
56
- }
57
- return docSnap.data() as WithStorageMeta<Payload>
58
- }))).filter(exists)
59
- }
60
-
61
- protected override async insertHandler(payloads: WithStorageMeta<Payload>[]): Promise<WithStorageMeta<Payload>[]> {
62
- const payloadCollection = this.collection
63
- return await Promise.all(payloads.map(
64
- async (payload) => {
65
- const docRef = doc(payloadCollection, payload._hash)
66
- await setDoc(docRef, payload)
67
- return payload
68
- },
69
- ))
70
- }
71
- }
package/src/Config.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { ArchivistConfig } from '@xyo-network/archivist-model'
2
- import { asSchema } from '@xyo-network/payload-model'
3
-
4
- import { FirebaseArchivistSchema } from './Schema.ts'
5
-
6
- export const FirebaseArchivistConfigSchema = asSchema(`${FirebaseArchivistSchema}.config`, true)
7
- export type FirebaseArchivistConfigSchema = typeof FirebaseArchivistConfigSchema
8
-
9
- export type FirebaseArchivistConfig = ArchivistConfig<{
10
- collection?: string
11
- dbId?: string
12
- schema: FirebaseArchivistConfigSchema
13
- }>
package/src/Params.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { FirebaseApp } from '@firebase/app'
2
- import type { ArchivistParams } from '@xyo-network/archivist-model'
3
- import type { AnyConfigSchema } from '@xyo-network/module-model'
4
-
5
- import type { FirebaseArchivistConfig } from './Config.ts'
6
-
7
- export interface FirebaseArchivistParams extends ArchivistParams<AnyConfigSchema<FirebaseArchivistConfig>> {
8
- firebaseApp?: FirebaseApp
9
- }
package/src/Schema.ts DELETED
@@ -1,4 +0,0 @@
1
- import { asSchema } from '@xyo-network/payload-model'
2
-
3
- export const FirebaseArchivistSchema = asSchema('network.xyo.archivist.firebase', true)
4
- export type FirebaseArchivistSchema = typeof FirebaseArchivistSchema
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './Archivist.ts'
2
- export * from './Config.ts'
3
- export * from './Params.ts'
4
- export * from './Schema.ts'
@@ -1,14 +0,0 @@
1
- service cloud.firestore {
2
- match /databases/{database}/documents {
3
-
4
- // Match any document in the "users" collection
5
- match /users/{userId} {
6
-
7
- // Allow read and write access if the requesting user is authenticated and their UID matches the document ID
8
- allow read, write: if request.auth != null && request.auth.uid == userId;
9
-
10
- // Deny all other access
11
- allow read, write: if false;
12
- }
13
- }
14
- }