@zuplo/cli 6.71.22 → 6.71.25
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/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml +42 -2
- package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml +6 -1
- package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/LICENSE +1 -1
- package/node_modules/@fastify/fast-json-stringify-compiler/README.md +1 -1
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.gitattributes +2 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/workflows/ci.yml +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/LICENSE +22 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/README.md +742 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js +116 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js +339 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-thread.js +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench.js +391 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/build/build-schema-validator.js +26 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/eslint.config.js +9 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/examples/example.js +81 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/examples/server.js +42 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/index.js +1308 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/location.js +24 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/merge-schemas.js +9 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/schema-validator.js +1134 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/serializer.js +141 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/standalone.js +34 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/validator.js +96 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/package.json +89 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/additionalProperties.test.js +332 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/allof.test.js +751 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/any.test.js +231 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/anyof.test.js +812 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/array.test.js +688 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/asNumber.test.js +13 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/basic.test.js +400 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/bigint.test.js +76 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/clean-cache.test.js +47 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/const.test.js +314 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/date.test.js +639 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/debug-mode.test.js +130 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/defaults.test.js +376 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/enum.test.js +37 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/fix-604.test.js +25 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/fixtures/.keep +0 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/if-then-else.test.js +540 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/inferType.test.js +92 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/infinity.test.js +55 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/integer.test.js +194 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/invalidSchema.test.js +38 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-479.test.js +57 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-793.test.js +107 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-794.test.js +177 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-836.test.js +183 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-add-comma.test.js +57 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md +10 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json +54 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json +70 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json +70 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js +31 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/missing-values.test.js +88 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/multi-type-serializer.test.js +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/nestedObjects.test.js +63 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/nullable.test.js +543 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/oneof.test.js +510 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/patternProperties.test.js +168 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/recursion.test.js +245 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/ref.json +12 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/ref.test.js +2077 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/regex.test.js +32 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/required.test.js +204 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/requiresAjv.test.js +50 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize.test.js +141 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize2.test.js +18 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize3.test.js +17 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize4.test.js +16 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize5.test.js +16 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize6.test.js +22 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize7.test.js +68 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/side-effect.test.js +196 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/standalone-mode.test.js +219 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/string.test.js +84 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/surrogate.test.js +67 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/toJSON.test.js +203 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/typebox.test.js +36 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/typesArray.test.js +550 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/unknownFormats.test.js +27 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/webpack.test.js +50 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/types/index.d.ts +219 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/types/index.tst.ts +259 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/package.json +6 -11
- package/node_modules/@fastify/fast-json-stringify-compiler/types/{index.test-d.ts → index.tst.ts} +34 -32
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +5 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +50 -10
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +47 -10
- package/node_modules/@posthog/core/dist/posthog-core.d.ts +2 -2
- package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core.js +10 -6
- package/node_modules/@posthog/core/dist/posthog-core.mjs +11 -7
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts +1 -0
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.js +3 -0
- package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.mjs +3 -0
- package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts +3 -0
- package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/promise-queue.js +15 -3
- package/node_modules/@posthog/core/dist/utils/promise-queue.mjs +15 -3
- package/node_modules/@posthog/core/package.json +1 -1
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +80 -14
- package/node_modules/@posthog/core/src/posthog-core.ts +18 -7
- package/node_modules/@posthog/core/src/testing/PostHogCoreTestClient.ts +4 -0
- package/node_modules/@posthog/core/src/utils/promise-queue.ts +17 -4
- package/node_modules/@posthog/types/dist/posthog.d.ts +12 -0
- package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/posthog.ts +13 -0
- package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/utf8/index.js +29 -18
- package/node_modules/@protobufjs/utf8/package.json +2 -2
- package/node_modules/@protobufjs/utf8/tests/index.js +5 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +64 -25
- package/node_modules/@types/node/crypto.d.ts +18 -5
- package/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +3 -0
- package/node_modules/@types/node/fs.d.ts +21 -6
- package/node_modules/@types/node/http.d.ts +25 -0
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +14 -1
- package/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/node/sqlite.d.ts +55 -0
- package/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/node/stream.d.ts +32 -0
- package/node_modules/@types/node/test.d.ts +112 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/util.d.ts +19 -2
- package/node_modules/@types/node/v8.d.ts +84 -2
- package/node_modules/@types/node/worker_threads.d.ts +8 -7
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/out/esm/index.js +11 -11
- package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-54PA7VDV.js → chunk-4QJJMELB.js} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-54PA7VDV.js.map → chunk-4QJJMELB.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-MJWTZPC2.js +402 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-MJWTZPC2.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +7 -7
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +263 -19
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +33 -7
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
- package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/utils/body.js +12 -4
- package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
- package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
- package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
- package/node_modules/hono/dist/utils/body.js +12 -4
- package/node_modules/hono/dist/utils/buffer.js +2 -1
- package/node_modules/hono/dist/validator/validator.js +3 -3
- package/node_modules/hono/package.json +8 -7
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/protobuf.js +5 -2
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/package.json +1 -1
- package/node_modules/protobufjs/src/parse.js +3 -0
- package/node_modules/toad-cache/README.md +10 -9
- package/node_modules/toad-cache/dist/toad-cache.cjs +139 -139
- package/node_modules/toad-cache/dist/toad-cache.mjs +136 -140
- package/node_modules/toad-cache/package.json +8 -8
- package/node_modules/toad-cache/toad-cache.d.cts +20 -14
- package/node_modules/toad-cache/toad-cache.d.ts +18 -14
- package/package.json +6 -6
- package/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js +0 -389
- package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js.map +0 -1
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-36XLJ4X6.js.LEGAL.txt → chunk-MJWTZPC2.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog-core-stateless.d.ts","sourceRoot":"","sources":["../src/posthog-core-stateless.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGnD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAGhB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EAExB,MAAM,EACN,cAAc,EAEf,MAAM,SAAS,CAAA;AAChB,OAAO,EAML,gBAAgB,EAMjB,MAAM,SA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,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4D1G,OAAO,CAAC,gBAAgB;IAyBxB,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,sBAAsB;IAuBhG,OAAO,CAAC,eAAe;IAOvB;;;OAGG;IACH,OAAO,CAAC,eAAe;YAMT,sBAAsB;IAsBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,SAAS,CAAC,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,OAAO,CAAC,aAAa;IAwCrB,SAAS,CAAC,gBAAgB,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;YAazC,MAAM;IAkGpB;;;;;;;;;OASG;IACG,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC;YAwC/D,cAAc;IAsDtB,SAAS,CAAC,iBAAiB,GAAE,MAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0DjE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,QAAQ,CAAC,iBAAiB,GAAE,MAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAYjE"}
|
|
@@ -24,11 +24,12 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
isPostHogFetchNetworkError: ()=>isPostHogFetchNetworkError,
|
|
27
28
|
maybeAdd: ()=>maybeAdd,
|
|
28
29
|
logFlushError: ()=>logFlushError,
|
|
29
30
|
PostHogCoreStateless: ()=>PostHogCoreStateless,
|
|
30
31
|
QuotaLimitedFeature: ()=>posthog_core_stateless_QuotaLimitedFeature,
|
|
31
|
-
|
|
32
|
+
applyCallerFeatureFlagOverrides: ()=>applyCallerFeatureFlagOverrides
|
|
32
33
|
});
|
|
33
34
|
const external_eventemitter_js_namespaceObject = require("./eventemitter.js");
|
|
34
35
|
const external_featureFlagUtils_js_namespaceObject = require("./featureFlagUtils.js");
|
|
@@ -61,6 +62,9 @@ class PostHogFetchNetworkError extends Error {
|
|
|
61
62
|
const maybeAdd = (key, value)=>void 0 !== value ? {
|
|
62
63
|
[key]: value
|
|
63
64
|
} : {};
|
|
65
|
+
const applyCallerFeatureFlagOverrides = (target, callerProperties)=>{
|
|
66
|
+
for (const key of Object.keys(callerProperties))if (key.startsWith('$feature/') || '$active_feature_flags' === key) target[key] = callerProperties[key];
|
|
67
|
+
};
|
|
64
68
|
async function logFlushError(err) {
|
|
65
69
|
if (err instanceof PostHogFetchHttpError) {
|
|
66
70
|
let text = '';
|
|
@@ -78,6 +82,7 @@ function isPostHogFetchNetworkError(err) {
|
|
|
78
82
|
return err instanceof PostHogFetchNetworkError;
|
|
79
83
|
}
|
|
80
84
|
function isRetryableFlagsFetchError(err) {
|
|
85
|
+
if (err instanceof PostHogFetchHttpError) return 502 === err.status || 504 === err.status;
|
|
81
86
|
if (!(err instanceof PostHogFetchNetworkError)) return false;
|
|
82
87
|
const cause = err.error;
|
|
83
88
|
const code = cause?.code ?? cause?.cause?.code;
|
|
@@ -113,6 +118,7 @@ class PostHogCoreStateless {
|
|
|
113
118
|
}
|
|
114
119
|
constructor(apiKey, options = {}){
|
|
115
120
|
this.flushPromise = null;
|
|
121
|
+
this.flushPromises = new Set();
|
|
116
122
|
this.shutdownPromise = null;
|
|
117
123
|
this.promiseQueue = new index_js_namespaceObject.PromiseQueue();
|
|
118
124
|
this._events = new external_eventemitter_js_namespaceObject.SimpleEventEmitter();
|
|
@@ -196,13 +202,16 @@ class PostHogCoreStateless {
|
|
|
196
202
|
return this.disabled;
|
|
197
203
|
}
|
|
198
204
|
buildPayload(payload) {
|
|
205
|
+
const userProperties = payload.properties || {};
|
|
206
|
+
const properties = {
|
|
207
|
+
...userProperties,
|
|
208
|
+
...this.getCommonEventProperties()
|
|
209
|
+
};
|
|
210
|
+
applyCallerFeatureFlagOverrides(properties, userProperties);
|
|
199
211
|
return {
|
|
200
212
|
distinct_id: payload.distinct_id,
|
|
201
213
|
event: payload.event,
|
|
202
|
-
properties
|
|
203
|
-
...payload.properties || {},
|
|
204
|
-
...this.getCommonEventProperties()
|
|
205
|
-
}
|
|
214
|
+
properties
|
|
206
215
|
};
|
|
207
216
|
}
|
|
208
217
|
addPendingPromise(promise) {
|
|
@@ -619,16 +628,45 @@ class PostHogCoreStateless {
|
|
|
619
628
|
await logFlushError(err);
|
|
620
629
|
});
|
|
621
630
|
}
|
|
622
|
-
async
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
631
|
+
async waitForPendingPromises(maxPromiseId, ignoredPromises = []) {
|
|
632
|
+
const ignoredPendingPromises = ignoredPromises.filter((promise)=>!!promise);
|
|
633
|
+
let iteration = 0;
|
|
634
|
+
while(true){
|
|
635
|
+
const promises = this.promiseQueue.getPromises([
|
|
636
|
+
...ignoredPendingPromises,
|
|
637
|
+
...this.flushPromises
|
|
638
|
+
], maxPromiseId);
|
|
639
|
+
if (0 === promises.length) return;
|
|
640
|
+
if (iteration > 0) this._logger.debug(`flush() re-checking ${promises.length} pending promise(s) before flushing`);
|
|
641
|
+
await Promise.all(promises.map((promise)=>promise.catch(()=>{})));
|
|
642
|
+
iteration++;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
flushWithPendingPromises() {
|
|
646
|
+
return this.flushInternal(true);
|
|
647
|
+
}
|
|
648
|
+
flush() {
|
|
649
|
+
return this.flushInternal(false);
|
|
650
|
+
}
|
|
651
|
+
flushInternal(waitForPendingPromises) {
|
|
652
|
+
if (this.disabled) return Promise.resolve();
|
|
653
|
+
const previousFlushPromise = this.flushPromise;
|
|
654
|
+
const maxPromiseId = this.promiseQueue.maxId;
|
|
655
|
+
const nextFlushPromise = Promise.resolve().then(()=>{
|
|
656
|
+
if (waitForPendingPromises) return this.waitForPendingPromises(maxPromiseId, [
|
|
657
|
+
previousFlushPromise,
|
|
658
|
+
nextFlushPromise
|
|
659
|
+
]);
|
|
660
|
+
}).then(()=>(0, index_js_namespaceObject.allSettled)([
|
|
661
|
+
previousFlushPromise
|
|
662
|
+
])).then(()=>this._flush());
|
|
627
663
|
this.flushPromise = nextFlushPromise;
|
|
664
|
+
this.flushPromises.add(nextFlushPromise);
|
|
628
665
|
this.addPendingPromise(nextFlushPromise);
|
|
629
666
|
(0, index_js_namespaceObject.allSettled)([
|
|
630
667
|
nextFlushPromise
|
|
631
668
|
]).then(()=>{
|
|
669
|
+
this.flushPromises.delete(nextFlushPromise);
|
|
632
670
|
if (this.flushPromise === nextFlushPromise) this.flushPromise = null;
|
|
633
671
|
});
|
|
634
672
|
return nextFlushPromise;
|
|
@@ -823,12 +861,14 @@ class PostHogCoreStateless {
|
|
|
823
861
|
}
|
|
824
862
|
exports.PostHogCoreStateless = __webpack_exports__.PostHogCoreStateless;
|
|
825
863
|
exports.QuotaLimitedFeature = __webpack_exports__.QuotaLimitedFeature;
|
|
864
|
+
exports.applyCallerFeatureFlagOverrides = __webpack_exports__.applyCallerFeatureFlagOverrides;
|
|
826
865
|
exports.isPostHogFetchNetworkError = __webpack_exports__.isPostHogFetchNetworkError;
|
|
827
866
|
exports.logFlushError = __webpack_exports__.logFlushError;
|
|
828
867
|
exports.maybeAdd = __webpack_exports__.maybeAdd;
|
|
829
868
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
830
869
|
"PostHogCoreStateless",
|
|
831
870
|
"QuotaLimitedFeature",
|
|
871
|
+
"applyCallerFeatureFlagOverrides",
|
|
832
872
|
"isPostHogFetchNetworkError",
|
|
833
873
|
"logFlushError",
|
|
834
874
|
"maybeAdd"
|
|
@@ -29,6 +29,9 @@ class PostHogFetchNetworkError extends Error {
|
|
|
29
29
|
const maybeAdd = (key, value)=>void 0 !== value ? {
|
|
30
30
|
[key]: value
|
|
31
31
|
} : {};
|
|
32
|
+
const applyCallerFeatureFlagOverrides = (target, callerProperties)=>{
|
|
33
|
+
for (const key of Object.keys(callerProperties))if (key.startsWith('$feature/') || '$active_feature_flags' === key) target[key] = callerProperties[key];
|
|
34
|
+
};
|
|
32
35
|
async function logFlushError(err) {
|
|
33
36
|
if (err instanceof PostHogFetchHttpError) {
|
|
34
37
|
let text = '';
|
|
@@ -46,6 +49,7 @@ function isPostHogFetchNetworkError(err) {
|
|
|
46
49
|
return err instanceof PostHogFetchNetworkError;
|
|
47
50
|
}
|
|
48
51
|
function isRetryableFlagsFetchError(err) {
|
|
52
|
+
if (err instanceof PostHogFetchHttpError) return 502 === err.status || 504 === err.status;
|
|
49
53
|
if (!(err instanceof PostHogFetchNetworkError)) return false;
|
|
50
54
|
const cause = err.error;
|
|
51
55
|
const code = cause?.code ?? cause?.cause?.code;
|
|
@@ -81,6 +85,7 @@ class PostHogCoreStateless {
|
|
|
81
85
|
}
|
|
82
86
|
constructor(apiKey, options = {}){
|
|
83
87
|
this.flushPromise = null;
|
|
88
|
+
this.flushPromises = new Set();
|
|
84
89
|
this.shutdownPromise = null;
|
|
85
90
|
this.promiseQueue = new PromiseQueue();
|
|
86
91
|
this._events = new SimpleEventEmitter();
|
|
@@ -164,13 +169,16 @@ class PostHogCoreStateless {
|
|
|
164
169
|
return this.disabled;
|
|
165
170
|
}
|
|
166
171
|
buildPayload(payload) {
|
|
172
|
+
const userProperties = payload.properties || {};
|
|
173
|
+
const properties = {
|
|
174
|
+
...userProperties,
|
|
175
|
+
...this.getCommonEventProperties()
|
|
176
|
+
};
|
|
177
|
+
applyCallerFeatureFlagOverrides(properties, userProperties);
|
|
167
178
|
return {
|
|
168
179
|
distinct_id: payload.distinct_id,
|
|
169
180
|
event: payload.event,
|
|
170
|
-
properties
|
|
171
|
-
...payload.properties || {},
|
|
172
|
-
...this.getCommonEventProperties()
|
|
173
|
-
}
|
|
181
|
+
properties
|
|
174
182
|
};
|
|
175
183
|
}
|
|
176
184
|
addPendingPromise(promise) {
|
|
@@ -587,16 +595,45 @@ class PostHogCoreStateless {
|
|
|
587
595
|
await logFlushError(err);
|
|
588
596
|
});
|
|
589
597
|
}
|
|
590
|
-
async
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
598
|
+
async waitForPendingPromises(maxPromiseId, ignoredPromises = []) {
|
|
599
|
+
const ignoredPendingPromises = ignoredPromises.filter((promise)=>!!promise);
|
|
600
|
+
let iteration = 0;
|
|
601
|
+
while(true){
|
|
602
|
+
const promises = this.promiseQueue.getPromises([
|
|
603
|
+
...ignoredPendingPromises,
|
|
604
|
+
...this.flushPromises
|
|
605
|
+
], maxPromiseId);
|
|
606
|
+
if (0 === promises.length) return;
|
|
607
|
+
if (iteration > 0) this._logger.debug(`flush() re-checking ${promises.length} pending promise(s) before flushing`);
|
|
608
|
+
await Promise.all(promises.map((promise)=>promise.catch(()=>{})));
|
|
609
|
+
iteration++;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
flushWithPendingPromises() {
|
|
613
|
+
return this.flushInternal(true);
|
|
614
|
+
}
|
|
615
|
+
flush() {
|
|
616
|
+
return this.flushInternal(false);
|
|
617
|
+
}
|
|
618
|
+
flushInternal(waitForPendingPromises) {
|
|
619
|
+
if (this.disabled) return Promise.resolve();
|
|
620
|
+
const previousFlushPromise = this.flushPromise;
|
|
621
|
+
const maxPromiseId = this.promiseQueue.maxId;
|
|
622
|
+
const nextFlushPromise = Promise.resolve().then(()=>{
|
|
623
|
+
if (waitForPendingPromises) return this.waitForPendingPromises(maxPromiseId, [
|
|
624
|
+
previousFlushPromise,
|
|
625
|
+
nextFlushPromise
|
|
626
|
+
]);
|
|
627
|
+
}).then(()=>allSettled([
|
|
628
|
+
previousFlushPromise
|
|
629
|
+
])).then(()=>this._flush());
|
|
595
630
|
this.flushPromise = nextFlushPromise;
|
|
631
|
+
this.flushPromises.add(nextFlushPromise);
|
|
596
632
|
this.addPendingPromise(nextFlushPromise);
|
|
597
633
|
allSettled([
|
|
598
634
|
nextFlushPromise
|
|
599
635
|
]).then(()=>{
|
|
636
|
+
this.flushPromises.delete(nextFlushPromise);
|
|
600
637
|
if (this.flushPromise === nextFlushPromise) this.flushPromise = null;
|
|
601
638
|
});
|
|
602
639
|
return nextFlushPromise;
|
|
@@ -789,4 +826,4 @@ class PostHogCoreStateless {
|
|
|
789
826
|
return this.shutdownPromise;
|
|
790
827
|
}
|
|
791
828
|
}
|
|
792
|
-
export { PostHogCoreStateless, posthog_core_stateless_QuotaLimitedFeature as QuotaLimitedFeature, isPostHogFetchNetworkError, logFlushError, maybeAdd };
|
|
829
|
+
export { PostHogCoreStateless, posthog_core_stateless_QuotaLimitedFeature as QuotaLimitedFeature, applyCallerFeatureFlagOverrides, isPostHogFetchNetworkError, logFlushError, maybeAdd };
|
|
@@ -154,7 +154,7 @@ export declare abstract class PostHogCore extends PostHogCoreStateless {
|
|
|
154
154
|
*/
|
|
155
155
|
missingFlagBehavior?: 'getFeatureFlag' | 'getFeatureFlagPayload';
|
|
156
156
|
}): FeatureFlagResult | undefined;
|
|
157
|
-
getFeatureFlag(key: string): FeatureFlagValue | undefined;
|
|
157
|
+
getFeatureFlag(key: string, options?: FeatureFlagResultOptions): FeatureFlagValue | undefined;
|
|
158
158
|
/**
|
|
159
159
|
* @deprecated Use `getFeatureFlagResult()` instead, which returns the flag value and payload from a single evaluation.
|
|
160
160
|
*/
|
|
@@ -166,7 +166,7 @@ export declare abstract class PostHogCore extends PostHogCoreStateless {
|
|
|
166
166
|
flags: PostHogFlagsResponse['featureFlags'] | undefined;
|
|
167
167
|
payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;
|
|
168
168
|
};
|
|
169
|
-
isFeatureEnabled(key: string): boolean | undefined;
|
|
169
|
+
isFeatureEnabled(key: string, options?: FeatureFlagResultOptions): boolean | undefined;
|
|
170
170
|
reloadFeatureFlags(options?: {
|
|
171
171
|
cb?: (err?: Error, flags?: PostHogFlagsResponse['featureFlags']) => void;
|
|
172
172
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog-core.d.ts","sourceRoot":"","sources":["../src/posthog-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EAGxB,yBAAyB,EAKzB,sBAAsB,EAGvB,MAAM,SAAS,CAAA;AAahB,OAAO,EAAiC,wBAAwB,EAAE,MAAM,SAAS,CAAA;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"posthog-core.d.ts","sourceRoot":"","sources":["../src/posthog-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EAGxB,yBAAyB,EAKzB,sBAAsB,EAGvB,MAAM,SAAS,CAAA;AAahB,OAAO,EAAiC,wBAAwB,EAAE,MAAM,SAAS,CAAA;AACjF,OAAO,EAGL,oBAAoB,EAErB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAG5C,UAAU,iBAAiB;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAOD,8BAAsB,WAAY,SAAQ,oBAAoB;IAE5D,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,yBAAyB,CAAS;IAC1C,OAAO,CAAC,gBAAgB,CAA2D;IACn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
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
enrichProperties(properties) {
|
|
126
|
-
|
|
126
|
+
const userProperties = properties || {};
|
|
127
|
+
const enriched = {
|
|
127
128
|
...this.props,
|
|
128
129
|
...this.sessionProps,
|
|
129
|
-
...
|
|
130
|
+
...userProperties,
|
|
130
131
|
...this.getCommonEventProperties(),
|
|
131
132
|
$session_id: this.getSessionId()
|
|
132
133
|
};
|
|
134
|
+
(0, external_posthog_core_stateless_js_namespaceObject.applyCallerFeatureFlagOverrides)(enriched, userProperties);
|
|
135
|
+
return enriched;
|
|
133
136
|
}
|
|
134
137
|
getSessionId() {
|
|
135
138
|
if (!this._isInitialized) return '';
|
|
@@ -606,9 +609,10 @@ class PostHogCore extends external_posthog_core_stateless_js_namespaceObject.Pos
|
|
|
606
609
|
payload
|
|
607
610
|
};
|
|
608
611
|
}
|
|
609
|
-
getFeatureFlag(key) {
|
|
612
|
+
getFeatureFlag(key, options) {
|
|
610
613
|
const result = this._getFeatureFlagResult(key, {
|
|
611
|
-
missingFlagBehavior: 'getFeatureFlag'
|
|
614
|
+
missingFlagBehavior: 'getFeatureFlag',
|
|
615
|
+
sendEvent: options?.sendEvent
|
|
612
616
|
});
|
|
613
617
|
return result?.variant ?? result?.enabled;
|
|
614
618
|
}
|
|
@@ -653,8 +657,8 @@ class PostHogCore extends external_posthog_core_stateless_js_namespaceObject.Pos
|
|
|
653
657
|
payloads
|
|
654
658
|
};
|
|
655
659
|
}
|
|
656
|
-
isFeatureEnabled(key) {
|
|
657
|
-
const response = this.getFeatureFlag(key);
|
|
660
|
+
isFeatureEnabled(key, options) {
|
|
661
|
+
const response = this.getFeatureFlag(key, options);
|
|
658
662
|
if (void 0 === response) return;
|
|
659
663
|
return !!response;
|
|
660
664
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFlagsResponseFromFlagsAndPayloads, flagDetailsToResults, getEnabledFromValue, getFeatureFlagValue, getFlagValuesFromFlags, getPayloadsFromFlags, getVariantFromValue, normalizeFlagsResponse, parsePayload, updateFlagValue } from "./featureFlagUtils.mjs";
|
|
2
2
|
import { Compression, FeatureFlagError, PostHogPersistedProperty } from "./types.mjs";
|
|
3
|
-
import { PostHogCoreStateless, QuotaLimitedFeature, maybeAdd } from "./posthog-core-stateless.mjs";
|
|
3
|
+
import { PostHogCoreStateless, QuotaLimitedFeature, applyCallerFeatureFlagOverrides, maybeAdd } from "./posthog-core-stateless.mjs";
|
|
4
4
|
import { uuidv7 } from "./vendor/uuidv7.mjs";
|
|
5
5
|
import { getEventUuid, getPersonPropertiesHash, isArray, isEmptyObject, isNullish, isObject, isString } from "./utils/index.mjs";
|
|
6
6
|
class PostHogCore extends PostHogCoreStateless {
|
|
@@ -95,13 +95,16 @@ class PostHogCore extends PostHogCoreStateless {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
enrichProperties(properties) {
|
|
98
|
-
|
|
98
|
+
const userProperties = properties || {};
|
|
99
|
+
const enriched = {
|
|
99
100
|
...this.props,
|
|
100
101
|
...this.sessionProps,
|
|
101
|
-
...
|
|
102
|
+
...userProperties,
|
|
102
103
|
...this.getCommonEventProperties(),
|
|
103
104
|
$session_id: this.getSessionId()
|
|
104
105
|
};
|
|
106
|
+
applyCallerFeatureFlagOverrides(enriched, userProperties);
|
|
107
|
+
return enriched;
|
|
105
108
|
}
|
|
106
109
|
getSessionId() {
|
|
107
110
|
if (!this._isInitialized) return '';
|
|
@@ -578,9 +581,10 @@ class PostHogCore extends PostHogCoreStateless {
|
|
|
578
581
|
payload
|
|
579
582
|
};
|
|
580
583
|
}
|
|
581
|
-
getFeatureFlag(key) {
|
|
584
|
+
getFeatureFlag(key, options) {
|
|
582
585
|
const result = this._getFeatureFlagResult(key, {
|
|
583
|
-
missingFlagBehavior: 'getFeatureFlag'
|
|
586
|
+
missingFlagBehavior: 'getFeatureFlag',
|
|
587
|
+
sendEvent: options?.sendEvent
|
|
584
588
|
});
|
|
585
589
|
return result?.variant ?? result?.enabled;
|
|
586
590
|
}
|
|
@@ -625,8 +629,8 @@ class PostHogCore extends PostHogCoreStateless {
|
|
|
625
629
|
payloads
|
|
626
630
|
};
|
|
627
631
|
}
|
|
628
|
-
isFeatureEnabled(key) {
|
|
629
|
-
const response = this.getFeatureFlag(key);
|
|
632
|
+
isFeatureEnabled(key, options) {
|
|
633
|
+
const response = this.getFeatureFlag(key, options);
|
|
630
634
|
if (void 0 === response) return;
|
|
631
635
|
return !!response;
|
|
632
636
|
}
|
|
@@ -12,6 +12,7 @@ export declare class PostHogCoreTestClient extends PostHogCore {
|
|
|
12
12
|
_cachedDistinctId?: string;
|
|
13
13
|
constructor(mocks: PostHogCoreTestClientMocks, apiKey: string, options?: PostHogCoreOptions);
|
|
14
14
|
getFlags(distinctId: string, groups?: Record<string, string | number>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>, extraPayload?: Record<string, any>): Promise<GetFlagsResult>;
|
|
15
|
+
flushWithPendingPromises(): Promise<void>;
|
|
15
16
|
getPersistedProperty<T>(key: string): T;
|
|
16
17
|
setPersistedProperty<T>(key: string, value: T | null): void;
|
|
17
18
|
fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostHogCoreTestClient.d.ts","sourceRoot":"","sources":["../../src/testing/PostHogCoreTestClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAItH,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAA;IAC9E,OAAO,EAAE;QACP,OAAO,EAAE,IAAI,CAAC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ACtD,CAAC,qBAAqB,EAAE,0BAA0B,CAsBpD,CAAA"}
|
|
@@ -37,6 +37,9 @@ class PostHogCoreTestClient extends external_posthog_core_js_namespaceObject.Pos
|
|
|
37
37
|
getFlags(distinctId, groups = {}, personProperties = {}, groupProperties = {}, extraPayload = {}) {
|
|
38
38
|
return super.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload);
|
|
39
39
|
}
|
|
40
|
+
flushWithPendingPromises() {
|
|
41
|
+
return super.flushWithPendingPromises();
|
|
42
|
+
}
|
|
40
43
|
getPersistedProperty(key) {
|
|
41
44
|
return this.mocks.storage.getItem(key);
|
|
42
45
|
}
|
|
@@ -8,6 +8,9 @@ class PostHogCoreTestClient extends PostHogCore {
|
|
|
8
8
|
getFlags(distinctId, groups = {}, personProperties = {}, groupProperties = {}, extraPayload = {}) {
|
|
9
9
|
return super.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload);
|
|
10
10
|
}
|
|
11
|
+
flushWithPendingPromises() {
|
|
12
|
+
return super.flushWithPendingPromises();
|
|
13
|
+
}
|
|
11
14
|
getPersistedProperty(key) {
|
|
12
15
|
return this.mocks.storage.getItem(key);
|
|
13
16
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export declare class PromiseQueue {
|
|
2
2
|
private promiseByIds;
|
|
3
|
+
private nextId;
|
|
3
4
|
add(promise: Promise<any>): Promise<any>;
|
|
4
5
|
join(): Promise<void>;
|
|
6
|
+
getPromises(ignoredPromises?: Promise<any>[], maxId?: number): Promise<any>[];
|
|
7
|
+
get maxId(): number;
|
|
5
8
|
get length(): number;
|
|
6
9
|
}
|
|
7
10
|
//# sourceMappingURL=promise-queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise-queue.d.ts","sourceRoot":"","sources":["../../src/utils/promise-queue.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"promise-queue.d.ts","sourceRoot":"","sources":["../../src/utils/promise-queue.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAA4D;IAChF,OAAO,CAAC,MAAM,CAAY;IAEnB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAYlC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAU3B,WAAW,CAAC,eAAe,GAAE,OAAO,CAAC,GAAG,CAAC,EAAO,EAAE,KAAK,GAAE,MAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE;IAOrG,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;CACF"}
|
|
@@ -30,26 +30,38 @@ const uuidv7_js_namespaceObject = require("../vendor/uuidv7.js");
|
|
|
30
30
|
class PromiseQueue {
|
|
31
31
|
add(promise) {
|
|
32
32
|
const promiseUUID = (0, uuidv7_js_namespaceObject.uuidv7)();
|
|
33
|
-
|
|
33
|
+
const id = ++this.nextId;
|
|
34
|
+
this.promiseByIds[promiseUUID] = {
|
|
35
|
+
id,
|
|
36
|
+
promise
|
|
37
|
+
};
|
|
34
38
|
promise.catch(()=>{}).finally(()=>{
|
|
35
39
|
delete this.promiseByIds[promiseUUID];
|
|
36
40
|
});
|
|
37
41
|
return promise;
|
|
38
42
|
}
|
|
39
43
|
async join() {
|
|
40
|
-
let promises = Object.values(this.promiseByIds);
|
|
44
|
+
let promises = Object.values(this.promiseByIds).map((item)=>item.promise);
|
|
41
45
|
let length = promises.length;
|
|
42
46
|
while(length > 0){
|
|
43
47
|
await Promise.all(promises);
|
|
44
|
-
promises = Object.values(this.promiseByIds);
|
|
48
|
+
promises = Object.values(this.promiseByIds).map((item)=>item.promise);
|
|
45
49
|
length = promises.length;
|
|
46
50
|
}
|
|
47
51
|
}
|
|
52
|
+
getPromises(ignoredPromises = [], maxId = this.nextId) {
|
|
53
|
+
const ignoredPromiseSet = new Set(ignoredPromises);
|
|
54
|
+
return Object.values(this.promiseByIds).filter((item)=>item.id <= maxId && !ignoredPromiseSet.has(item.promise)).map((item)=>item.promise);
|
|
55
|
+
}
|
|
56
|
+
get maxId() {
|
|
57
|
+
return this.nextId;
|
|
58
|
+
}
|
|
48
59
|
get length() {
|
|
49
60
|
return Object.keys(this.promiseByIds).length;
|
|
50
61
|
}
|
|
51
62
|
constructor(){
|
|
52
63
|
this.promiseByIds = {};
|
|
64
|
+
this.nextId = 0;
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
exports.PromiseQueue = __webpack_exports__.PromiseQueue;
|
|
@@ -2,26 +2,38 @@ import { uuidv7 } from "../vendor/uuidv7.mjs";
|
|
|
2
2
|
class PromiseQueue {
|
|
3
3
|
add(promise) {
|
|
4
4
|
const promiseUUID = uuidv7();
|
|
5
|
-
|
|
5
|
+
const id = ++this.nextId;
|
|
6
|
+
this.promiseByIds[promiseUUID] = {
|
|
7
|
+
id,
|
|
8
|
+
promise
|
|
9
|
+
};
|
|
6
10
|
promise.catch(()=>{}).finally(()=>{
|
|
7
11
|
delete this.promiseByIds[promiseUUID];
|
|
8
12
|
});
|
|
9
13
|
return promise;
|
|
10
14
|
}
|
|
11
15
|
async join() {
|
|
12
|
-
let promises = Object.values(this.promiseByIds);
|
|
16
|
+
let promises = Object.values(this.promiseByIds).map((item)=>item.promise);
|
|
13
17
|
let length = promises.length;
|
|
14
18
|
while(length > 0){
|
|
15
19
|
await Promise.all(promises);
|
|
16
|
-
promises = Object.values(this.promiseByIds);
|
|
20
|
+
promises = Object.values(this.promiseByIds).map((item)=>item.promise);
|
|
17
21
|
length = promises.length;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
24
|
+
getPromises(ignoredPromises = [], maxId = this.nextId) {
|
|
25
|
+
const ignoredPromiseSet = new Set(ignoredPromises);
|
|
26
|
+
return Object.values(this.promiseByIds).filter((item)=>item.id <= maxId && !ignoredPromiseSet.has(item.promise)).map((item)=>item.promise);
|
|
27
|
+
}
|
|
28
|
+
get maxId() {
|
|
29
|
+
return this.nextId;
|
|
30
|
+
}
|
|
20
31
|
get length() {
|
|
21
32
|
return Object.keys(this.promiseByIds).length;
|
|
22
33
|
}
|
|
23
34
|
constructor(){
|
|
24
35
|
this.promiseByIds = {};
|
|
36
|
+
this.nextId = 0;
|
|
25
37
|
}
|
|
26
38
|
}
|
|
27
39
|
export { PromiseQueue };
|