Odoo GraphQL Subscription using Node, Express JS for Sample
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
6.4 KiB

5 months ago
{"version":3,"file":"reactiveVars.js","sourceRoot":"","sources":["../../../src/cache/inmemory/reactiveVars.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAarC,yEAAyE;AACzE,gCAAgC;AAChC,MAAM,CAAC,IAAM,SAAS,GAAG,IAAI,IAAI,EAAoB,CAAC;AAEtD,IAAM,YAAY,GAAG,IAAI,OAAO,EAM7B,CAAC;AAEJ,SAAS,YAAY,CAAC,KAAuB;IAC3C,IAAI,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,YAAY,CAAC,GAAG,CACd,KAAK,EACL,CAAC,IAAI,GAAG;YACN,IAAI,EAAE,IAAI,GAAG,EAAE;YACf,GAAG,EAAE,GAAG,EAAE;SACX,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,EAAE,IAAK,OAAA,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAArB,CAAqB,CAAC,CAAC;AAClE,CAAC;AAED,yEAAyE;AACzE,kEAAkE;AAClE,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,wEAAwE;AACxE,mEAAmE;AACnE,wDAAwD;AACxD,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,EAAE,IAAK,OAAA,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAArB,CAAqB,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU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,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,IAAM,MAAM,GAAG,CAAC,EAAE,CAAC,WAAW,GAAG,UAAC,KAAK;QACrC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClB,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,WAAW,GAAG,UAAC,KAAK,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAApB,CAAoB,CAAC;IAEjD,OAAO,EAAE,CAAC;AACZ,CAAC;AAQD,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3B,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["import type { OptimisticDependencyFunction } from \"optimism\";\nimport { dep, Slot } from \"optimism\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type { ApolloCache } from \"../../core/index.js\";\n\nexport interface ReactiveVar<T> {\n (newValue?: T): T;\n onNextChange(listener: ReactiveListener<T>): () => void;\n attachCache(cache: ApolloCache<any>): this;\n forgetCache(cache: ApolloCache<any>): boolean;\n}\n\nexport type ReactiveListener<T> = (value: T) => any;\n\n// Contextual Slot that acquires its value when custom read functions are\n// called in Policies#readField.\nexport const cacheSlot = new Slot<ApolloCache<any>>();\n\nconst cacheInfoMap = new WeakMap<\n ApolloCache<any>,\n {\n vars: Set<ReactiveVar<any>>;\n dep: OptimisticDependencyFunction<ReactiveVar<any>>;\n }\n>();\n\nfunction getCacheInfo(cache: ApolloCache<any>) {\n let info = cacheInfoMap.get(cache)!;\n if (!info) {\n cacheInfoMap.set(\n cache,\n (info = {\n vars: new Set(),\n dep: dep(),\n })\n );\n }\n return info;\n}\n\nexport function forgetCache(cache: ApolloCache<any>) {\n getCacheInfo(cache).vars.forEach((rv) => rv.forgetCache(cache));\n}\n\n// Calling forgetCache(cache) serves to silence broadcasts and allows the\n// cache to be garbage collected. However, the varsByCache WeakMap\n// preserves the set of reactive variables that were previously associated\n// with this cache, which makes it possible to \"recall\" the cach