@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
|
@@ -83,6 +83,18 @@ class PostHogFetchNetworkError extends Error {
|
|
|
83
83
|
export const maybeAdd = (key: string, value: JsonType | undefined): Record<string, JsonType> =>
|
|
84
84
|
value !== undefined ? { [key]: value } : {}
|
|
85
85
|
|
|
86
|
+
// Caller-supplied `$feature/*` and `$active_feature_flags` win over the SDK's cached flag values.
|
|
87
|
+
export const applyCallerFeatureFlagOverrides = (
|
|
88
|
+
target: PostHogEventProperties,
|
|
89
|
+
callerProperties: PostHogEventProperties
|
|
90
|
+
): void => {
|
|
91
|
+
for (const key of Object.keys(callerProperties)) {
|
|
92
|
+
if (key.startsWith('$feature/') || key === '$active_feature_flags') {
|
|
93
|
+
target[key] = callerProperties[key]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
86
98
|
export async function logFlushError(err: any): Promise<void> {
|
|
87
99
|
if (err instanceof PostHogFetchHttpError) {
|
|
88
100
|
let text = ''
|
|
@@ -113,7 +125,13 @@ export function isPostHogFetchNetworkError(err: unknown): err is PostHogFetchNet
|
|
|
113
125
|
return err instanceof PostHogFetchNetworkError
|
|
114
126
|
}
|
|
115
127
|
|
|
116
|
-
function isRetryableFlagsFetchError(
|
|
128
|
+
function isRetryableFlagsFetchError(
|
|
129
|
+
err: unknown
|
|
130
|
+
): err is PostHogFetchNetworkError | (PostHogFetchHttpError & { status: 502 | 504 }) {
|
|
131
|
+
if (err instanceof PostHogFetchHttpError) {
|
|
132
|
+
return err.status === 502 || err.status === 504
|
|
133
|
+
}
|
|
134
|
+
|
|
117
135
|
if (!(err instanceof PostHogFetchNetworkError)) {
|
|
118
136
|
return false
|
|
119
137
|
}
|
|
@@ -171,6 +189,7 @@ export abstract class PostHogCoreStateless {
|
|
|
171
189
|
private maxQueueSize: number
|
|
172
190
|
private flushInterval: number
|
|
173
191
|
private flushPromise: Promise<any> | null = null
|
|
192
|
+
private flushPromises: Set<Promise<any>> = new Set()
|
|
174
193
|
private shutdownPromise: Promise<void> | null = null
|
|
175
194
|
private requestTimeout: number
|
|
176
195
|
private featureFlagsRequestTimeoutMs: number
|
|
@@ -377,13 +396,16 @@ export abstract class PostHogCoreStateless {
|
|
|
377
396
|
event: string
|
|
378
397
|
properties?: PostHogEventProperties
|
|
379
398
|
}): PostHogEventProperties {
|
|
399
|
+
const userProperties = payload.properties || {}
|
|
400
|
+
const properties: PostHogEventProperties = {
|
|
401
|
+
...userProperties,
|
|
402
|
+
...this.getCommonEventProperties(), // Common PH props
|
|
403
|
+
}
|
|
404
|
+
applyCallerFeatureFlagOverrides(properties, userProperties)
|
|
380
405
|
return {
|
|
381
406
|
distinct_id: payload.distinct_id,
|
|
382
407
|
event: payload.event,
|
|
383
|
-
properties
|
|
384
|
-
...(payload.properties || {}),
|
|
385
|
-
...this.getCommonEventProperties(), // Common PH props
|
|
386
|
-
},
|
|
408
|
+
properties,
|
|
387
409
|
}
|
|
388
410
|
}
|
|
389
411
|
|
|
@@ -615,7 +637,7 @@ export abstract class PostHogCoreStateless {
|
|
|
615
637
|
|
|
616
638
|
this._logger.info('Flags URL', url)
|
|
617
639
|
|
|
618
|
-
// Retry only network/transport/timeout failures
|
|
640
|
+
// Retry only network/transport/timeout failures and selected gateway HTTP errors for /flags.
|
|
619
641
|
return this.fetchWithRetry(
|
|
620
642
|
url,
|
|
621
643
|
fetchOptions,
|
|
@@ -1174,6 +1196,28 @@ export abstract class PostHogCoreStateless {
|
|
|
1174
1196
|
})
|
|
1175
1197
|
}
|
|
1176
1198
|
|
|
1199
|
+
private async waitForPendingPromises(
|
|
1200
|
+
maxPromiseId: number,
|
|
1201
|
+
ignoredPromises: (Promise<any> | null | undefined)[] = []
|
|
1202
|
+
): Promise<void> {
|
|
1203
|
+
const ignoredPendingPromises = ignoredPromises.filter((promise): promise is Promise<any> => !!promise)
|
|
1204
|
+
let iteration = 0
|
|
1205
|
+
|
|
1206
|
+
while (true) {
|
|
1207
|
+
const promises = this.promiseQueue.getPromises([...ignoredPendingPromises, ...this.flushPromises], maxPromiseId)
|
|
1208
|
+
if (promises.length === 0) {
|
|
1209
|
+
return
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
if (iteration > 0) {
|
|
1213
|
+
this._logger.debug(`flush() re-checking ${promises.length} pending promise(s) before flushing`)
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
await Promise.all(promises.map((promise) => promise.catch(() => {})))
|
|
1217
|
+
iteration++
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1177
1221
|
/**
|
|
1178
1222
|
* Flushes the queue of pending events.
|
|
1179
1223
|
*
|
|
@@ -1202,22 +1246,44 @@ export abstract class PostHogCoreStateless {
|
|
|
1202
1246
|
* @throws PostHogFetchNetworkError
|
|
1203
1247
|
* @throws Error
|
|
1204
1248
|
*/
|
|
1205
|
-
|
|
1249
|
+
protected flushWithPendingPromises(): Promise<void> {
|
|
1250
|
+
return this.flushInternal(true)
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
flush(): Promise<void> {
|
|
1254
|
+
return this.flushInternal(false)
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
private flushInternal(waitForPendingPromises: boolean): Promise<void> {
|
|
1206
1258
|
if (this.disabled) {
|
|
1207
|
-
return
|
|
1259
|
+
return Promise.resolve()
|
|
1208
1260
|
}
|
|
1209
1261
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1262
|
+
const previousFlushPromise = this.flushPromise
|
|
1263
|
+
const maxPromiseId = this.promiseQueue.maxId
|
|
1264
|
+
|
|
1265
|
+
// Register this flush in the promise queue synchronously so shutdown() can't miss it,
|
|
1266
|
+
// but exclude it from the pending-work wait to avoid self-waiting.
|
|
1267
|
+
const nextFlushPromise: Promise<void> = Promise.resolve()
|
|
1268
|
+
.then(() => {
|
|
1269
|
+
if (waitForPendingPromises) {
|
|
1270
|
+
return this.waitForPendingPromises(maxPromiseId, [previousFlushPromise, nextFlushPromise])
|
|
1271
|
+
}
|
|
1272
|
+
})
|
|
1273
|
+
// Wait for the current flush operation to finish (regardless of success or failure), then try to flush again.
|
|
1274
|
+
// Use allSettled instead of finally to be defensive around flush throwing errors immediately rather than rejecting.
|
|
1275
|
+
// Use a custom allSettled implementation to avoid issues with patching Promise on RN
|
|
1276
|
+
.then(() => allSettled([previousFlushPromise]))
|
|
1277
|
+
.then(() => {
|
|
1278
|
+
return this._flush()
|
|
1279
|
+
})
|
|
1216
1280
|
|
|
1217
1281
|
this.flushPromise = nextFlushPromise
|
|
1282
|
+
this.flushPromises.add(nextFlushPromise)
|
|
1218
1283
|
void this.addPendingPromise(nextFlushPromise)
|
|
1219
1284
|
|
|
1220
1285
|
allSettled([nextFlushPromise]).then(() => {
|
|
1286
|
+
this.flushPromises.delete(nextFlushPromise)
|
|
1221
1287
|
// If there are no others waiting to flush, clear the promise.
|
|
1222
1288
|
// We don't strictly need to do this, but it could make debugging easier
|
|
1223
1289
|
if (this.flushPromise === nextFlushPromise) {
|
|
@@ -34,7 +34,12 @@ import {
|
|
|
34
34
|
updateFlagValue,
|
|
35
35
|
} from './featureFlagUtils'
|
|
36
36
|
import { Compression, FeatureFlagError, PostHogPersistedProperty } from './types'
|
|
37
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
applyCallerFeatureFlagOverrides,
|
|
39
|
+
maybeAdd,
|
|
40
|
+
PostHogCoreStateless,
|
|
41
|
+
QuotaLimitedFeature,
|
|
42
|
+
} from './posthog-core-stateless'
|
|
38
43
|
import { uuidv7 } from './vendor/uuidv7'
|
|
39
44
|
import { isEmptyObject, isNullish, getPersonPropertiesHash, isObject, isArray, isString, getEventUuid } from './utils'
|
|
40
45
|
import { EventHint } from './error-tracking'
|
|
@@ -220,13 +225,16 @@ export abstract class PostHogCore extends PostHogCoreStateless {
|
|
|
220
225
|
}
|
|
221
226
|
|
|
222
227
|
private enrichProperties(properties?: PostHogEventProperties): PostHogEventProperties {
|
|
223
|
-
|
|
228
|
+
const userProperties = properties || {}
|
|
229
|
+
const enriched: PostHogEventProperties = {
|
|
224
230
|
...this.props, // Persisted properties first
|
|
225
231
|
...this.sessionProps, // Followed by session properties
|
|
226
|
-
...
|
|
232
|
+
...userProperties, // Followed by user specified properties
|
|
227
233
|
...this.getCommonEventProperties(), // Followed by FF props
|
|
228
234
|
$session_id: this.getSessionId(),
|
|
229
235
|
}
|
|
236
|
+
applyCallerFeatureFlagOverrides(enriched, userProperties)
|
|
237
|
+
return enriched
|
|
230
238
|
}
|
|
231
239
|
|
|
232
240
|
/**
|
|
@@ -1060,8 +1068,11 @@ export abstract class PostHogCore extends PostHogCoreStateless {
|
|
|
1060
1068
|
}
|
|
1061
1069
|
}
|
|
1062
1070
|
|
|
1063
|
-
getFeatureFlag(key: string): FeatureFlagValue | undefined {
|
|
1064
|
-
const result = this._getFeatureFlagResult(key, {
|
|
1071
|
+
getFeatureFlag(key: string, options?: FeatureFlagResultOptions): FeatureFlagValue | undefined {
|
|
1072
|
+
const result = this._getFeatureFlagResult(key, {
|
|
1073
|
+
missingFlagBehavior: 'getFeatureFlag',
|
|
1074
|
+
sendEvent: options?.sendEvent,
|
|
1075
|
+
})
|
|
1065
1076
|
return result?.variant ?? result?.enabled
|
|
1066
1077
|
}
|
|
1067
1078
|
|
|
@@ -1129,8 +1140,8 @@ export abstract class PostHogCore extends PostHogCoreStateless {
|
|
|
1129
1140
|
}
|
|
1130
1141
|
}
|
|
1131
1142
|
|
|
1132
|
-
isFeatureEnabled(key: string): boolean | undefined {
|
|
1133
|
-
const response = this.getFeatureFlag(key)
|
|
1143
|
+
isFeatureEnabled(key: string, options?: FeatureFlagResultOptions): boolean | undefined {
|
|
1144
|
+
const response = this.getFeatureFlag(key, options)
|
|
1134
1145
|
if (response === undefined) {
|
|
1135
1146
|
return undefined
|
|
1136
1147
|
}
|
|
@@ -35,6 +35,10 @@ export class PostHogCoreTestClient extends PostHogCore {
|
|
|
35
35
|
return super.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
public flushWithPendingPromises(): Promise<void> {
|
|
39
|
+
return super.flushWithPendingPromises()
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
getPersistedProperty<T>(key: string): T {
|
|
39
43
|
return this.mocks.storage.getItem(key)
|
|
40
44
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { uuidv7 } from '../vendor/uuidv7'
|
|
2
2
|
|
|
3
3
|
export class PromiseQueue {
|
|
4
|
-
private promiseByIds: Record<string, Promise<any
|
|
4
|
+
private promiseByIds: Record<string, { id: number; promise: Promise<any> }> = {}
|
|
5
|
+
private nextId: number = 0
|
|
5
6
|
|
|
6
7
|
public add(promise: Promise<any>): Promise<any> {
|
|
7
8
|
const promiseUUID = uuidv7()
|
|
8
|
-
|
|
9
|
+
const id = ++this.nextId
|
|
10
|
+
this.promiseByIds[promiseUUID] = { id, promise }
|
|
9
11
|
promise
|
|
10
12
|
.catch(() => {})
|
|
11
13
|
.finally(() => {
|
|
@@ -15,15 +17,26 @@ export class PromiseQueue {
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
public async join(): Promise<void> {
|
|
18
|
-
let promises = Object.values(this.promiseByIds)
|
|
20
|
+
let promises = Object.values(this.promiseByIds).map((item) => item.promise)
|
|
19
21
|
let length = promises.length
|
|
20
22
|
while (length > 0) {
|
|
21
23
|
await Promise.all(promises)
|
|
22
|
-
promises = Object.values(this.promiseByIds)
|
|
24
|
+
promises = Object.values(this.promiseByIds).map((item) => item.promise)
|
|
23
25
|
length = promises.length
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
public getPromises(ignoredPromises: Promise<any>[] = [], maxId: number = this.nextId): Promise<any>[] {
|
|
30
|
+
const ignoredPromiseSet = new Set(ignoredPromises)
|
|
31
|
+
return Object.values(this.promiseByIds)
|
|
32
|
+
.filter((item) => item.id <= maxId && !ignoredPromiseSet.has(item.promise))
|
|
33
|
+
.map((item) => item.promise)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public get maxId(): number {
|
|
37
|
+
return this.nextId
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
public get length(): number {
|
|
28
41
|
return Object.keys(this.promiseByIds).length
|
|
29
42
|
}
|
|
@@ -151,6 +151,18 @@ export interface PostHog {
|
|
|
151
151
|
* @param {boolean} [reset_device_id] Whether to generate a new device ID as well as a new distinct ID.
|
|
152
152
|
*/
|
|
153
153
|
reset(reset_device_id?: boolean): void;
|
|
154
|
+
/**
|
|
155
|
+
* Flush any queued events and gracefully tear down the SDK.
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* Provided for parity with the server-side Node.js SDK. In the browser the SDK
|
|
159
|
+
* already flushes on page unload, so this best-effort flushes queued events and
|
|
160
|
+
* always resolves — it never throws — which makes isomorphic teardown safe.
|
|
161
|
+
*
|
|
162
|
+
* @param {number} [shutdownTimeoutMs] Accepted for parity with the Node.js SDK; unused in the browser.
|
|
163
|
+
* @returns {Promise<void>} Resolves once teardown is complete.
|
|
164
|
+
*/
|
|
165
|
+
shutdown(shutdownTimeoutMs?: number): Promise<void>;
|
|
154
166
|
/**
|
|
155
167
|
* Create a person profile for the current user.
|
|
156
168
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../src/posthog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,KAAK,EACR,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC9B,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,OAAO;IACpB;;OAEG;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AwB,IAAI,IAAI,CAAA;IAMhC;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAA;IAM3C;;;;OAIG;IACH,aAAa,IAAI,MAAM,GAAG,SAAS,CAAA;IAMnC;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1E;;;;;;OAMG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IAM9G;;OAEG;IACH,MAAM,EAAE;QACJ,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;QACjF,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;KACzF,CAAA;IAED;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAA;CAChC"}
|
|
@@ -190,6 +190,19 @@ export interface PostHog {
|
|
|
190
190
|
*/
|
|
191
191
|
reset(reset_device_id?: boolean): void
|
|
192
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Flush any queued events and gracefully tear down the SDK.
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* Provided for parity with the server-side Node.js SDK. In the browser the SDK
|
|
198
|
+
* already flushes on page unload, so this best-effort flushes queued events and
|
|
199
|
+
* always resolves — it never throws — which makes isomorphic teardown safe.
|
|
200
|
+
*
|
|
201
|
+
* @param {number} [shutdownTimeoutMs] Accepted for parity with the Node.js SDK; unused in the browser.
|
|
202
|
+
* @returns {Promise<void>} Resolves once teardown is complete.
|
|
203
|
+
*/
|
|
204
|
+
shutdown(shutdownTimeoutMs?: number): Promise<void>
|
|
205
|
+
|
|
193
206
|
/**
|
|
194
207
|
* Create a person profile for the current user.
|
|
195
208
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.1.2](https://github.com/protobufjs/protobuf.js/compare/utf8-v1.1.1...utf8-v1.1.2) (2026-07-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Performance Improvements
|
|
7
|
+
|
|
8
|
+
* Batch String.fromCharCode in @protobufjs/utf8 read ([#2355](https://github.com/protobufjs/protobuf.js/issues/2355)) ([d1ae3ce](https://github.com/protobufjs/protobuf.js/commit/d1ae3ce46370254ada0f3db689506a9139c8d1ee))
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @namespace
|
|
7
7
|
*/
|
|
8
8
|
var utf8 = exports,
|
|
9
|
-
|
|
9
|
+
replacementCharCode = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Calculates the UTF8 byte length of a string.
|
|
@@ -39,34 +39,45 @@ utf8.length = function utf8_length(string) {
|
|
|
39
39
|
* @returns {string} String read
|
|
40
40
|
*/
|
|
41
41
|
utf8.read = function utf8_read(buffer, start, end) {
|
|
42
|
-
if (end - start < 1)
|
|
42
|
+
if (end - start < 1)
|
|
43
43
|
return "";
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
// Batch code units and flush via String.fromCharCode.apply in 8192-unit
|
|
45
|
+
// chunks to avoid the per-character ConsString buildup of `str += ...`.
|
|
46
|
+
var parts = null,
|
|
47
|
+
chunk = [],
|
|
48
|
+
i = 0, // chunk write index
|
|
49
|
+
t, t2, c2, c3;
|
|
50
|
+
while (start < end) {
|
|
51
|
+
t = buffer[start++];
|
|
49
52
|
if (t <= 0x7F) {
|
|
50
|
-
|
|
53
|
+
chunk[i++] = t;
|
|
51
54
|
} else if (t >= 0xC0 && t < 0xE0) {
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
c2 = (t & 0x1F) << 6 | buffer[start++] & 0x3F;
|
|
56
|
+
chunk[i++] = c2 >= 0x80 ? c2 : replacementCharCode;
|
|
54
57
|
} else if (t >= 0xE0 && t < 0xF0) {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
c3 = (t & 0xF) << 12 | (buffer[start++] & 0x3F) << 6 | buffer[start++] & 0x3F;
|
|
59
|
+
chunk[i++] = c3 >= 0x800 ? c3 : replacementCharCode;
|
|
57
60
|
} else if (t >= 0xF0) {
|
|
58
|
-
|
|
61
|
+
t2 = (t & 7) << 18 | (buffer[start++] & 0x3F) << 12 | (buffer[start++] & 0x3F) << 6 | buffer[start++] & 0x3F;
|
|
59
62
|
if (t2 < 0x10000 || t2 > 0x10FFFF)
|
|
60
|
-
|
|
63
|
+
chunk[i++] = replacementCharCode;
|
|
61
64
|
else {
|
|
62
65
|
t2 -= 0x10000;
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
chunk[i++] = 0xD800 + (t2 >> 10);
|
|
67
|
+
chunk[i++] = 0xDC00 + (t2 & 0x3FF);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
70
|
+
if (i > 8191) {
|
|
71
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
72
|
+
i = 0;
|
|
73
|
+
}
|
|
67
74
|
}
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
if (parts) {
|
|
76
|
+
if (i)
|
|
77
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
78
|
+
return parts.join("");
|
|
79
|
+
}
|
|
80
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
|
70
81
|
};
|
|
71
82
|
|
|
72
83
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobufjs/utf8",
|
|
3
3
|
"description": "A minimal UTF8 implementation for number arrays.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "https://github.com/protobufjs/protobuf.js.git"
|
|
9
9
|
},
|
|
10
10
|
"license": "BSD-3-Clause",
|
|
11
11
|
"main": "index.js",
|
|
@@ -47,6 +47,11 @@ tape.test("utf8", function(test) {
|
|
|
47
47
|
test.equal(comp, "\ufffd", "should decode overlong UTF-8 sequences as replacement characters");
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
var longMultibyteStr = "\u20ac\u00df\u7a7a\u03bb\ud835\udd4f".repeat(20000); // 3-byte, 2-byte and surrogate-pair code points
|
|
51
|
+
var longMultibyte = Buffer.from(longMultibyteStr, "utf8");
|
|
52
|
+
comp = utf8.read(longMultibyte, 0, longMultibyte.length);
|
|
53
|
+
test.equal(comp, longMultibyteStr, "should decode a large multibyte string spanning many flush boundaries");
|
|
54
|
+
|
|
50
55
|
test.end();
|
|
51
56
|
});
|
|
52
57
|
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated: Wed,
|
|
11
|
+
* Last updated: Wed, 01 Jul 2026 11:03:38 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -1550,11 +1550,12 @@ declare module "node:buffer" {
|
|
|
1550
1550
|
/**
|
|
1551
1551
|
* If `value` is:
|
|
1552
1552
|
*
|
|
1553
|
-
* * a string, `value` is interpreted according to the character encoding in
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1553
|
+
* * a string, `value` is interpreted according to the character encoding in
|
|
1554
|
+
* `encoding`.
|
|
1555
|
+
* * a `Buffer` or `Uint8Array`, `value` will be used in its entirety.
|
|
1556
|
+
* To compare a partial `Buffer`, use `buf.subarray`.
|
|
1556
1557
|
* * a number, `value` will be interpreted as an unsigned 8-bit integer
|
|
1557
|
-
*
|
|
1558
|
+
* value between `0` and `255`.
|
|
1558
1559
|
*
|
|
1559
1560
|
* ```js
|
|
1560
1561
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1582,12 +1583,13 @@ declare module "node:buffer" {
|
|
|
1582
1583
|
* // Prints: 6
|
|
1583
1584
|
* ```
|
|
1584
1585
|
*
|
|
1585
|
-
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1586
|
+
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1587
|
+
* `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
|
1586
1588
|
* an integer between 0 and 255.
|
|
1587
1589
|
*
|
|
1588
1590
|
* If `byteOffset` is not a number, it will be coerced to a number. If the result
|
|
1589
1591
|
* of coercion is `NaN` or `0`, then the entire buffer will be searched. This
|
|
1590
|
-
* behavior matches
|
|
1592
|
+
* behavior matches `String.prototype.indexOf()`.
|
|
1591
1593
|
*
|
|
1592
1594
|
* ```js
|
|
1593
1595
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1608,14 +1610,27 @@ declare module "node:buffer" {
|
|
|
1608
1610
|
* ```
|
|
1609
1611
|
*
|
|
1610
1612
|
* If `value` is an empty string or empty `Buffer` and `byteOffset` is less
|
|
1611
|
-
* than `buf.length`, `byteOffset` will be returned. If `value` is empty and
|
|
1613
|
+
* than `buf.length`, `byteOffset` will be returned. If `value` is empty and
|
|
1614
|
+
* `byteOffset` is at least `buf.length`, `buf.length` will be returned.
|
|
1612
1615
|
* @since v1.5.0
|
|
1613
1616
|
* @param value What to search for.
|
|
1614
|
-
* @param
|
|
1615
|
-
*
|
|
1616
|
-
* @
|
|
1617
|
-
|
|
1618
|
-
|
|
1617
|
+
* @param start Where to begin searching in `buf`. If negative, then
|
|
1618
|
+
* offset is calculated from the end of `buf`. **Default:** `0`.
|
|
1619
|
+
* @param end Where to stop searching in `buf` (exclusive). **Default:**
|
|
1620
|
+
* `buf.length`.
|
|
1621
|
+
* @param encoding If `value` is a string, this is the encoding used to
|
|
1622
|
+
* determine the binary representation of the string that will be searched for in
|
|
1623
|
+
* `buf`. **Default:** `'utf8'`.
|
|
1624
|
+
* @returns The index of the first occurrence of `value` in `buf`, or
|
|
1625
|
+
* `-1` if `buf` does not contain `value`.
|
|
1626
|
+
*/
|
|
1627
|
+
indexOf(
|
|
1628
|
+
value: string | number | Uint8Array,
|
|
1629
|
+
start?: number,
|
|
1630
|
+
end?: number,
|
|
1631
|
+
encoding?: BufferEncoding,
|
|
1632
|
+
): number;
|
|
1633
|
+
indexOf(value: string | number | Uint8Array, start: number, encoding: BufferEncoding): number;
|
|
1619
1634
|
indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1620
1635
|
/**
|
|
1621
1636
|
* Identical to `buf.indexOf()`, except the last occurrence of `value` is found
|
|
@@ -1649,12 +1664,13 @@ declare module "node:buffer" {
|
|
|
1649
1664
|
* // Prints: 4
|
|
1650
1665
|
* ```
|
|
1651
1666
|
*
|
|
1652
|
-
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1667
|
+
* If `value` is not a string, number, or `Buffer`, this method will throw a
|
|
1668
|
+
* `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
|
1653
1669
|
* an integer between 0 and 255.
|
|
1654
1670
|
*
|
|
1655
1671
|
* If `byteOffset` is not a number, it will be coerced to a number. Any arguments
|
|
1656
1672
|
* that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
|
|
1657
|
-
* This behavior matches
|
|
1673
|
+
* This behavior matches `String.prototype.lastIndexOf()`.
|
|
1658
1674
|
*
|
|
1659
1675
|
* ```js
|
|
1660
1676
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1680,11 +1696,24 @@ declare module "node:buffer" {
|
|
|
1680
1696
|
* If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
|
|
1681
1697
|
* @since v6.0.0
|
|
1682
1698
|
* @param value What to search for.
|
|
1683
|
-
* @param
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
-
|
|
1687
|
-
|
|
1699
|
+
* @param start Where to begin searching in `buf`. If negative, then
|
|
1700
|
+
* offset is calculated from the end of `buf`. **Default:**
|
|
1701
|
+
* `buf.length - 1`.
|
|
1702
|
+
* @param end Where to stop searching in `buf` (exclusive). **Default:**
|
|
1703
|
+
* `buf.length`.
|
|
1704
|
+
* @param encoding If `value` is a string, this is the encoding used to
|
|
1705
|
+
* determine the binary representation of the string that will be searched for in
|
|
1706
|
+
* `buf`. **Default:** `'utf8'`.
|
|
1707
|
+
* @returns The index of the last occurrence of `value` in `buf`, or
|
|
1708
|
+
* `-1` if `buf` does not contain `value`.
|
|
1709
|
+
*/
|
|
1710
|
+
lastIndexOf(
|
|
1711
|
+
value: string | number | Uint8Array,
|
|
1712
|
+
start?: number,
|
|
1713
|
+
end?: number,
|
|
1714
|
+
encoding?: BufferEncoding,
|
|
1715
|
+
): number;
|
|
1716
|
+
lastIndexOf(value: string | number | Uint8Array, start: number, encoding: BufferEncoding): number;
|
|
1688
1717
|
lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1689
1718
|
/**
|
|
1690
1719
|
* Equivalent to `buf.indexOf() !== -1`.
|
|
@@ -1711,12 +1740,22 @@ declare module "node:buffer" {
|
|
|
1711
1740
|
* ```
|
|
1712
1741
|
* @since v5.3.0
|
|
1713
1742
|
* @param value What to search for.
|
|
1714
|
-
* @param
|
|
1715
|
-
*
|
|
1716
|
-
* @
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1743
|
+
* @param start Where to begin searching in `buf`. If negative, then
|
|
1744
|
+
* offset is calculated from the end of `buf`. **Default:** `0`.
|
|
1745
|
+
* @param end Where to stop searching in `buf` (exclusive). **Default:**
|
|
1746
|
+
* `buf.length`.
|
|
1747
|
+
* @param encoding If `value` is a string, this is its encoding.
|
|
1748
|
+
* **Default:** `'utf8'`.
|
|
1749
|
+
* @returns `true` if `value` was found in `buf`, `false` otherwise.
|
|
1750
|
+
*/
|
|
1751
|
+
includes(
|
|
1752
|
+
value: string | number | Uint8Array,
|
|
1753
|
+
start?: number,
|
|
1754
|
+
end?: number,
|
|
1755
|
+
encoding?: BufferEncoding,
|
|
1756
|
+
): boolean;
|
|
1757
|
+
includes(value: string | number | Uint8Array, start: number, encoding: BufferEncoding): boolean;
|
|
1758
|
+
includes(value: string | number | Uint8Array, encoding: BufferEncoding): boolean;
|
|
1720
1759
|
}
|
|
1721
1760
|
var Buffer: BufferConstructor;
|
|
1722
1761
|
}
|