@opencrvs/toolkit 2.0.0-rc.ff04b30 → 2.0.0-rc.ff777d6

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.
@@ -580,14 +580,12 @@ export type EncodedScope = z.infer<typeof EncodedScope>;
580
580
  */
581
581
  export declare const encodeScope: (scope: Scope) => EncodedScope;
582
582
  /**
583
- * Converts a scope object into an encoded query string representation.
583
+ * Converts an encoded scope string into a scope object.
584
584
  *
585
- * @TODO scope param could be defined as EncodedScope instead of string.
586
- *
587
- * @param scope - The scope object to encode.
588
- * @returns The encoded scope as a branded string (`EncodedScope`).
585
+ * @param scope - The encoded scope string to decode.
586
+ * @returns The decoded scope object.
589
587
  */
590
- export declare const decodeScope: (query: EncodedScope) => {
588
+ export declare const decodeScope: (encodedScope: EncodedScope) => {
591
589
  type: "record.create" | "record.declare" | "record.notify";
592
590
  options?: {
593
591
  event?: string[] | undefined;
@@ -354,14 +354,20 @@ var encodeScope = (scope) => {
354
354
  encode: false
355
355
  });
356
356
  };
357
- var decodeScope = (query) => {
358
- const scope = qs.parse(query, {
357
+ var decodedScopeCache = /* @__PURE__ */ new Map();
358
+ var decodeScope = (encodedScope) => {
359
+ if (decodedScopeCache.has(encodedScope)) {
360
+ return decodedScopeCache.get(encodedScope);
361
+ }
362
+ const scope = qs.parse(encodedScope, {
359
363
  ignoreQueryPrefix: true,
360
364
  comma: true,
361
365
  allowDots: true
362
366
  });
363
367
  const unflattenedScope = unflattenScope(scope);
364
- return Scope2.safeParse(unflattenedScope)?.data;
368
+ const result = Scope2.safeParse(unflattenedScope)?.data;
369
+ decodedScopeCache.set(encodedScope, result);
370
+ return result;
365
371
  };
366
372
  var DEFAULT_SCOPE_OPTIONS = {
367
373
  placeOfEvent: JurisdictionFilter.enum.all,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.ff04b30",
3
+ "version": "2.0.0-rc.ff777d6",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -20,6 +20,10 @@
20
20
  "build": "./build.sh",
21
21
  "build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit && ./build.sh"
22
22
  },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/opencrvs/opencrvs-core.git"
26
+ },
23
27
  "dependencies": {
24
28
  "@trpc/client": "11.4.3",
25
29
  "@trpc/server": "^11.8.0",
@@ -29,7 +33,7 @@
29
33
  "jwt-decode": "^3.0.0",
30
34
  "lodash": "^4.17.10",
31
35
  "object-hash": "^3.0.0",
32
- "qs": "6.14.0",
36
+ "qs": "6.15.2",
33
37
  "superjson": "1.9.0-0",
34
38
  "ts-morph": "^27.0.2",
35
39
  "uuid": "^9.0.0",