@jsdev_ninja/core 0.8.52 → 0.8.54

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.
@@ -1,4 +1,8 @@
1
- export declare const collections: {
1
+ export declare const systemCollections: {
2
+ readonly stores: "stores";
3
+ readonly companies: "companies";
4
+ };
5
+ export declare const storeCollections: {
2
6
  readonly products: "products";
3
7
  readonly profiles: "profiles";
4
8
  readonly cart: "cart";
@@ -6,24 +10,54 @@ export declare const collections: {
6
10
  readonly orders: "orders";
7
11
  readonly categories: "categories";
8
12
  readonly favorites: "favorites";
9
- readonly stores: "stores";
10
- readonly companies: "companies";
11
13
  readonly payments: "payments";
12
14
  };
13
15
  export declare const FirestoreApi: {
14
- getPath: ({ companyId, storeId, collectionName, }: {
16
+ systemCollections: {
17
+ readonly stores: "stores";
18
+ readonly companies: "companies";
19
+ };
20
+ storeCollections: {
21
+ readonly products: "products";
22
+ readonly profiles: "profiles";
23
+ readonly cart: "cart";
24
+ readonly clients: "clients";
25
+ readonly orders: "orders";
26
+ readonly categories: "categories";
27
+ readonly favorites: "favorites";
28
+ readonly payments: "payments";
29
+ };
30
+ getPath: ({ companyId, storeId, collectionName, id, }: {
15
31
  companyId: string;
16
32
  storeId: string;
17
- collectionName: keyof typeof collections;
33
+ collectionName: keyof typeof storeCollections;
34
+ id?: string;
18
35
  }) => string;
36
+ getDocPath: (collectionName: keyof typeof storeCollections) => string;
19
37
  };
20
38
  export declare const FirebaseAPI: {
21
39
  firestore: {
22
- getPath: ({ companyId, storeId, collectionName, }: {
40
+ systemCollections: {
41
+ readonly stores: "stores";
42
+ readonly companies: "companies";
43
+ };
44
+ storeCollections: {
45
+ readonly products: "products";
46
+ readonly profiles: "profiles";
47
+ readonly cart: "cart";
48
+ readonly clients: "clients";
49
+ readonly orders: "orders";
50
+ readonly categories: "categories";
51
+ readonly favorites: "favorites";
52
+ readonly payments: "payments";
53
+ };
54
+ getPath: ({ companyId, storeId, collectionName, id, }: {
23
55
  companyId: string;
24
56
  storeId: string;
25
- collectionName: keyof typeof collections;
57
+ collectionName: keyof typeof storeCollections;
58
+ id?: string;
26
59
  }) => string;
60
+ getDocPath: (collectionName: keyof typeof storeCollections) => string;
27
61
  };
28
62
  };
29
63
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;CAWd,CAAC;AAEX,eAAO,MAAM,YAAY;uDAKrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,WAAW,CAAC;KACzC;CAGD,CAAC;AAEF,eAAO,MAAM,WAAW;;2DATpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,WAAW,CAAC;SACzC;;CAOD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;CASnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;2DASrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;KACZ;iCAI4B,MAAM,OAAO,gBAAgB;CAG1D,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;+DAdpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;qCAI4B,MAAM,OAAO,gBAAgB;;CAO1D,CAAC"}
@@ -1,4 +1,8 @@
1
- export const collections = {
1
+ export const systemCollections = {
2
+ stores: "stores",
3
+ companies: "companies",
4
+ };
5
+ export const storeCollections = {
2
6
  products: "products",
3
7
  profiles: "profiles",
4
8
  cart: "cart",
@@ -6,13 +10,18 @@ export const collections = {
6
10
  orders: "orders",
7
11
  categories: "categories",
8
12
  favorites: "favorites",
9
- stores: "stores",
10
- companies: "companies",
11
13
  payments: "payments",
12
14
  };
13
15
  export const FirestoreApi = {
14
- getPath: ({ companyId, storeId, collectionName, }) => {
15
- return `${companyId}/${storeId}/${collectionName}`;
16
+ systemCollections,
17
+ storeCollections,
18
+ // for client
19
+ getPath: ({ companyId, storeId, collectionName, id, }) => {
20
+ return `${companyId}/${storeId}/${collectionName}${id ? `/${id}` : ""}`;
21
+ },
22
+ // for backend
23
+ getDocPath: (collectionName) => {
24
+ return `{companyId}/{storeId}/${collectionName}/{id}`;
16
25
  },
17
26
  };
18
27
  export const FirebaseAPI = {
@@ -1,4 +1,9 @@
1
- export const collections = {
1
+ export const systemCollections = {
2
+ stores: "stores",
3
+ companies: "companies",
4
+ } as const;
5
+
6
+ export const storeCollections = {
2
7
  products: "products",
3
8
  profiles: "profiles",
4
9
  cart: "cart",
@@ -6,22 +11,29 @@ export const collections = {
6
11
  orders: "orders",
7
12
  categories: "categories",
8
13
  favorites: "favorites",
9
- stores: "stores",
10
- companies: "companies",
11
14
  payments: "payments",
12
15
  } as const;
13
16
 
14
17
  export const FirestoreApi = {
18
+ systemCollections,
19
+ storeCollections,
20
+ // for client
15
21
  getPath: ({
16
22
  companyId,
17
23
  storeId,
18
24
  collectionName,
25
+ id,
19
26
  }: {
20
27
  companyId: string;
21
28
  storeId: string;
22
- collectionName: keyof typeof collections;
29
+ collectionName: keyof typeof storeCollections;
30
+ id?: string;
23
31
  }) => {
24
- return `${companyId}/${storeId}/${collectionName}`;
32
+ return `${companyId}/${storeId}/${collectionName}${id ? `/${id}` : ""}`;
33
+ },
34
+ // for backend
35
+ getDocPath: (collectionName: keyof typeof storeCollections) => {
36
+ return `{companyId}/{storeId}/${collectionName}/{id}`;
25
37
  },
26
38
  };
27
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.8.52",
3
+ "version": "0.8.54",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",
package/tsconfig.app.json CHANGED
@@ -14,6 +14,6 @@
14
14
  "skipLibCheck": true,
15
15
  "forceConsistentCasingInFileNames": true
16
16
  },
17
- "include": ["lib"],
18
- "exclude": ["node_modules", "dist", "src", "vite.config.ts"]
17
+ "include": ["lib", "dist"],
18
+ "exclude": ["node_modules", "src", "vite.config.ts"]
19
19
  }