@zuplo/cli 6.71.21 → 6.71.22

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.
Files changed (44) hide show
  1. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.d.ts.map +1 -1
  2. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.js +6 -24
  3. package/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs +7 -25
  4. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +1 -0
  5. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
  6. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +25 -7
  7. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +26 -8
  8. package/node_modules/@posthog/core/dist/utils/string-utils.d.ts +1 -0
  9. package/node_modules/@posthog/core/dist/utils/string-utils.d.ts.map +1 -1
  10. package/node_modules/@posthog/core/dist/utils/string-utils.js +21 -0
  11. package/node_modules/@posthog/core/dist/utils/string-utils.mjs +19 -1
  12. package/node_modules/@posthog/core/package.json +1 -1
  13. package/node_modules/@posthog/core/src/error-tracking/exception-steps.ts +5 -42
  14. package/node_modules/@posthog/core/src/posthog-core-stateless.ts +38 -9
  15. package/node_modules/@posthog/core/src/utils/string-utils.spec.ts +38 -1
  16. package/node_modules/@posthog/core/src/utils/string-utils.ts +42 -0
  17. package/node_modules/@zuplo/core/customer.cli.minified.js +2 -2
  18. package/node_modules/@zuplo/core/index.minified.js +2 -2
  19. package/node_modules/@zuplo/core/package.json +1 -1
  20. package/node_modules/@zuplo/graphql/package.json +1 -1
  21. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  22. package/node_modules/@zuplo/otel/package.json +1 -1
  23. package/node_modules/@zuplo/runtime/out/esm/{chunk-I5HLAHUY.js → chunk-36XLJ4X6.js} +143 -111
  24. package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js.map +1 -0
  25. package/node_modules/@zuplo/runtime/out/esm/{chunk-DQ4ANJLR.js → chunk-4MNJC7E2.js} +2 -2
  26. package/node_modules/@zuplo/runtime/out/esm/chunk-4MNJC7E2.js.map +1 -0
  27. package/node_modules/@zuplo/runtime/out/esm/{chunk-2Y72LML3.js → chunk-54PA7VDV.js} +2 -2
  28. package/node_modules/@zuplo/runtime/out/esm/{chunk-2Y72LML3.js.map → chunk-54PA7VDV.js.map} +1 -1
  29. package/node_modules/@zuplo/runtime/out/esm/{chunk-L3MZGNQA.js → chunk-DSZS6PZJ.js} +10 -10
  30. package/node_modules/@zuplo/runtime/out/esm/chunk-DSZS6PZJ.js.map +1 -0
  31. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  32. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  33. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  34. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  35. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  36. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  37. package/node_modules/@zuplo/runtime/out/types/index.d.ts +942 -0
  38. package/node_modules/@zuplo/runtime/package.json +1 -1
  39. package/package.json +6 -6
  40. package/node_modules/@zuplo/runtime/out/esm/chunk-DQ4ANJLR.js.map +0 -1
  41. package/node_modules/@zuplo/runtime/out/esm/chunk-I5HLAHUY.js.map +0 -1
  42. package/node_modules/@zuplo/runtime/out/esm/chunk-L3MZGNQA.js.map +0 -1
  43. /package/node_modules/@zuplo/runtime/out/esm/{chunk-I5HLAHUY.js.LEGAL.txt → chunk-36XLJ4X6.js.LEGAL.txt} +0 -0
  44. /package/node_modules/@zuplo/runtime/out/esm/{chunk-L3MZGNQA.js.LEGAL.txt → chunk-DSZS6PZJ.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"exception-steps.d.ts","sourceRoot":"","sources":["../../src/error-tracking/exception-steps.ts"],"names":[],"mappings":"AAEA,eAAO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,GAAG,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAgB9B,aAAa,IAAI,aAAa,EAAE;IAIhC,KAAK,IAAI,IAAI;IAKb,IAAI,IAAI,MAAM;IAIrB,OAAO,CAAC,eAAe;CAQxB;AAkDD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBvD"}
@@ -118,8 +118,12 @@ function normalizePositiveInteger(input, fallback) {
118
118
  return normalized;
119
119
  }
120
120
  function normalizeAndSerializeStep(step) {
121
- const json = safeStringify(step);
122
- if (!json) return;
121
+ let json;
122
+ try {
123
+ json = (0, index_js_namespaceObject.safeJsonStringify)(step);
124
+ } catch {
125
+ return;
126
+ }
123
127
  try {
124
128
  const parsed = JSON.parse(json);
125
129
  if (!(0, index_js_namespaceObject.isObject)(parsed)) return;
@@ -136,28 +140,6 @@ function normalizeAndSerializeStep(step) {
136
140
  return;
137
141
  }
138
142
  }
139
- function safeStringify(value) {
140
- const seen = new WeakSet();
141
- try {
142
- return JSON.stringify(value, (_key, replacementValue)=>{
143
- if ('bigint' == typeof replacementValue) return replacementValue.toString();
144
- if ('function' == typeof replacementValue || 'symbol' == typeof replacementValue) return;
145
- if (replacementValue instanceof Date) return replacementValue.toISOString();
146
- if (replacementValue instanceof Error) return {
147
- name: replacementValue.name,
148
- message: replacementValue.message,
149
- stack: replacementValue.stack
150
- };
151
- if (replacementValue && 'object' == typeof replacementValue) {
152
- if (seen.has(replacementValue)) return '[Circular]';
153
- seen.add(replacementValue);
154
- }
155
- return replacementValue;
156
- });
157
- } catch {
158
- return;
159
- }
160
- }
161
143
  function getUtf8ByteLength(value) {
162
144
  if ('undefined' != typeof TextEncoder) return new TextEncoder().encode(value).length;
163
145
  const encoded = encodeURIComponent(value);
@@ -1,4 +1,4 @@
1
- import { isNumber, isObject, isString } from "../utils/index.mjs";
1
+ import { isNumber, isObject, isString, safeJsonStringify } from "../utils/index.mjs";
2
2
  const EXCEPTION_STEP_INTERNAL_FIELDS = {
3
3
  MESSAGE: '$message',
4
4
  TIMESTAMP: '$timestamp'
@@ -85,8 +85,12 @@ function normalizePositiveInteger(input, fallback) {
85
85
  return normalized;
86
86
  }
87
87
  function normalizeAndSerializeStep(step) {
88
- const json = safeStringify(step);
89
- if (!json) return;
88
+ let json;
89
+ try {
90
+ json = safeJsonStringify(step);
91
+ } catch {
92
+ return;
93
+ }
90
94
  try {
91
95
  const parsed = JSON.parse(json);
92
96
  if (!isObject(parsed)) return;
@@ -103,28 +107,6 @@ function normalizeAndSerializeStep(step) {
103
107
  return;
104
108
  }
105
109
  }
106
- function safeStringify(value) {
107
- const seen = new WeakSet();
108
- try {
109
- return JSON.stringify(value, (_key, replacementValue)=>{
110
- if ('bigint' == typeof replacementValue) return replacementValue.toString();
111
- if ('function' == typeof replacementValue || 'symbol' == typeof replacementValue) return;
112
- if (replacementValue instanceof Date) return replacementValue.toISOString();
113
- if (replacementValue instanceof Error) return {
114
- name: replacementValue.name,
115
- message: replacementValue.message,
116
- stack: replacementValue.stack
117
- };
118
- if (replacementValue && 'object' == typeof replacementValue) {
119
- if (seen.has(replacementValue)) return '[Circular]';
120
- seen.add(replacementValue);
121
- }
122
- return replacementValue;
123
- });
124
- } catch {
125
- return;
126
- }
127
- }
128
110
  function getUtf8ByteLength(value) {
129
111
  if ('undefined' != typeof TextEncoder) return new TextEncoder().encode(value).length;
130
112
  const encoded = encodeURIComponent(value);
@@ -152,6 +152,7 @@ export declare abstract class PostHogCoreStateless {
152
152
  *** GROUPS
153
153
  ***/
154
154
  protected groupIdentifyStateless(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions, distinctId?: string, eventProperties?: PostHogEventProperties): void;
155
+ protected groupIdentifyStatelessImmediate(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions, distinctId?: string, eventProperties?: PostHogEventProperties): Promise<void>;
155
156
  protected getRemoteConfig(): Promise<PostHogRemoteConfig | undefined>;
156
157
  /***
157
158
  *** FEATURE FLAGS
@@ -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,EAKjB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,sBAAsB,EAMvB,MAAM,kBAAkB,CAAA;AAyBzB,cAAM,wBAAyB,SAAQ,KAAK;IAGvB,KAAK,EAAE,OAAO;IAFjC,IAAI,SAA6B;gBAEd,KAAK,EAAE,OAAO;CAMlC;AAED,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,EAAE,OAAO,QAAQ,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAC9C,CAAA;AAE7C,wBAAsB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3D;AAMD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAExF;AAoBD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,OAAO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;;;;;OA2BG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B5B,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"}
@@ -86,6 +86,10 @@ function isRetryableFlagsFetchError(err) {
86
86
  function isPostHogFetchContentTooLargeError(err) {
87
87
  return 'object' == typeof err && err instanceof PostHogFetchHttpError && 413 === err.status;
88
88
  }
89
+ function isPostHogFetchRetryableError(err) {
90
+ if (err instanceof PostHogFetchHttpError) return 408 === err.status || 429 === err.status || err.status >= 500;
91
+ return isPostHogFetchNetworkError(err);
92
+ }
89
93
  function isPostHogEventProperties(value) {
90
94
  return null !== value && 'object' == typeof value && !Array.isArray(value);
91
95
  }
@@ -130,7 +134,7 @@ class PostHogCoreStateless {
130
134
  this._retryOptions = {
131
135
  retryCount: options.fetchRetryCount ?? 3,
132
136
  retryDelay: options.fetchRetryDelay ?? 3000,
133
- retryCheck: isPostHogFetchError
137
+ retryCheck: isPostHogFetchRetryableError
134
138
  };
135
139
  this.requestTimeout = options.requestTimeout ?? 10000;
136
140
  this.featureFlagsRequestTimeoutMs = options.featureFlagsRequestTimeoutMs ?? 3000;
@@ -285,6 +289,19 @@ class PostHogCoreStateless {
285
289
  this.enqueue('capture', payload, options);
286
290
  });
287
291
  }
292
+ async groupIdentifyStatelessImmediate(groupType, groupKey, groupProperties, options, distinctId, eventProperties) {
293
+ const payload = this.buildPayload({
294
+ distinct_id: distinctId || `$${groupType}_${groupKey}`,
295
+ event: '$groupidentify',
296
+ properties: {
297
+ $group_type: groupType,
298
+ $group_key: groupKey,
299
+ $group_set: groupProperties || {},
300
+ ...eventProperties || {}
301
+ }
302
+ });
303
+ await this.sendImmediate('capture', payload, options);
304
+ }
288
305
  async getRemoteConfig() {
289
306
  await this._initPromise;
290
307
  let host = this.host;
@@ -423,8 +440,9 @@ class PostHogCoreStateless {
423
440
  }
424
441
  async getFeatureFlagDetailsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip, flagKeysToEvaluate) {
425
442
  await this._initPromise;
426
- const extraPayload = {};
427
- if (disableGeoip ?? this.disableGeoip) extraPayload['geoip_disable'] = true;
443
+ const extraPayload = {
444
+ geoip_disable: disableGeoip ?? this.disableGeoip
445
+ };
428
446
  if (flagKeysToEvaluate) extraPayload['flag_keys_to_evaluate'] = flagKeysToEvaluate;
429
447
  const result = await this.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload);
430
448
  if (!result.success) return;
@@ -537,7 +555,7 @@ class PostHogCoreStateless {
537
555
  sent_at: (0, index_js_namespaceObject.currentISOTime)()
538
556
  };
539
557
  if (this.historicalMigration) data.historical_migration = true;
540
- const payload = JSON.stringify(data);
558
+ const payload = (0, index_js_namespaceObject.safeJsonStringify)(data);
541
559
  const url = `${this.host}/batch/`;
542
560
  const gzippedPayload = this.disableCompression ? null : await (0, external_gzip_js_namespaceObject.gzipCompress)(payload, this.isDebug);
543
561
  const fetchOptions = {
@@ -644,7 +662,7 @@ class PostHogCoreStateless {
644
662
  sent_at: (0, index_js_namespaceObject.currentISOTime)()
645
663
  };
646
664
  if (this.historicalMigration) data.historical_migration = true;
647
- const payload = JSON.stringify(data);
665
+ const payload = (0, index_js_namespaceObject.safeJsonStringify)(data);
648
666
  const url = `${this.host}/batch/`;
649
667
  const gzippedPayload = this.disableCompression ? null : await (0, external_gzip_js_namespaceObject.gzipCompress)(payload, this.isDebug);
650
668
  const fetchOptions = {
@@ -661,7 +679,7 @@ class PostHogCoreStateless {
661
679
  const retryOptions = {
662
680
  retryCheck: (err)=>{
663
681
  if (isPostHogFetchContentTooLargeError(err)) return false;
664
- return isPostHogFetchError(err);
682
+ return isPostHogFetchRetryableError(err);
665
683
  }
666
684
  };
667
685
  try {
@@ -705,7 +723,7 @@ class PostHogCoreStateless {
705
723
  await this.fetchWithRetry(url, fetchOptions, {
706
724
  retryCheck: (err)=>{
707
725
  if (isPostHogFetchContentTooLargeError(err)) return false;
708
- return isPostHogFetchError(err);
726
+ return isPostHogFetchRetryableError(err);
709
727
  }
710
728
  });
711
729
  return {
@@ -2,7 +2,7 @@ import { SimpleEventEmitter } from "./eventemitter.mjs";
2
2
  import { getFeatureFlagValue, normalizeFlagsResponse } from "./featureFlagUtils.mjs";
3
3
  import { gzipCompress, isGzipSupported } from "./gzip.mjs";
4
4
  import { PostHogPersistedProperty } from "./types.mjs";
5
- import { PromiseQueue, STRING_FORMAT, allSettled, createLogger, currentISOTime, getEventUuid, removeTrailingSlash, retriable, safeSetTimeout } from "./utils/index.mjs";
5
+ import { PromiseQueue, STRING_FORMAT, allSettled, createLogger, currentISOTime, getEventUuid, removeTrailingSlash, retriable, safeJsonStringify, safeSetTimeout } from "./utils/index.mjs";
6
6
  import { uuidv7 } from "./vendor/uuidv7.mjs";
7
7
  import { ErrorCoercer, ErrorPropertiesBuilder, ObjectCoercer, PrimitiveCoercer, StringCoercer, createDefaultStackParser } from "./error-tracking/index.mjs";
8
8
  class PostHogFetchHttpError extends Error {
@@ -54,6 +54,10 @@ function isRetryableFlagsFetchError(err) {
54
54
  function isPostHogFetchContentTooLargeError(err) {
55
55
  return 'object' == typeof err && err instanceof PostHogFetchHttpError && 413 === err.status;
56
56
  }
57
+ function isPostHogFetchRetryableError(err) {
58
+ if (err instanceof PostHogFetchHttpError) return 408 === err.status || 429 === err.status || err.status >= 500;
59
+ return isPostHogFetchNetworkError(err);
60
+ }
57
61
  function isPostHogEventProperties(value) {
58
62
  return null !== value && 'object' == typeof value && !Array.isArray(value);
59
63
  }
@@ -98,7 +102,7 @@ class PostHogCoreStateless {
98
102
  this._retryOptions = {
99
103
  retryCount: options.fetchRetryCount ?? 3,
100
104
  retryDelay: options.fetchRetryDelay ?? 3000,
101
- retryCheck: isPostHogFetchError
105
+ retryCheck: isPostHogFetchRetryableError
102
106
  };
103
107
  this.requestTimeout = options.requestTimeout ?? 10000;
104
108
  this.featureFlagsRequestTimeoutMs = options.featureFlagsRequestTimeoutMs ?? 3000;
@@ -253,6 +257,19 @@ class PostHogCoreStateless {
253
257
  this.enqueue('capture', payload, options);
254
258
  });
255
259
  }
260
+ async groupIdentifyStatelessImmediate(groupType, groupKey, groupProperties, options, distinctId, eventProperties) {
261
+ const payload = this.buildPayload({
262
+ distinct_id: distinctId || `$${groupType}_${groupKey}`,
263
+ event: '$groupidentify',
264
+ properties: {
265
+ $group_type: groupType,
266
+ $group_key: groupKey,
267
+ $group_set: groupProperties || {},
268
+ ...eventProperties || {}
269
+ }
270
+ });
271
+ await this.sendImmediate('capture', payload, options);
272
+ }
256
273
  async getRemoteConfig() {
257
274
  await this._initPromise;
258
275
  let host = this.host;
@@ -391,8 +408,9 @@ class PostHogCoreStateless {
391
408
  }
392
409
  async getFeatureFlagDetailsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip, flagKeysToEvaluate) {
393
410
  await this._initPromise;
394
- const extraPayload = {};
395
- if (disableGeoip ?? this.disableGeoip) extraPayload['geoip_disable'] = true;
411
+ const extraPayload = {
412
+ geoip_disable: disableGeoip ?? this.disableGeoip
413
+ };
396
414
  if (flagKeysToEvaluate) extraPayload['flag_keys_to_evaluate'] = flagKeysToEvaluate;
397
415
  const result = await this.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload);
398
416
  if (!result.success) return;
@@ -505,7 +523,7 @@ class PostHogCoreStateless {
505
523
  sent_at: currentISOTime()
506
524
  };
507
525
  if (this.historicalMigration) data.historical_migration = true;
508
- const payload = JSON.stringify(data);
526
+ const payload = safeJsonStringify(data);
509
527
  const url = `${this.host}/batch/`;
510
528
  const gzippedPayload = this.disableCompression ? null : await gzipCompress(payload, this.isDebug);
511
529
  const fetchOptions = {
@@ -612,7 +630,7 @@ class PostHogCoreStateless {
612
630
  sent_at: currentISOTime()
613
631
  };
614
632
  if (this.historicalMigration) data.historical_migration = true;
615
- const payload = JSON.stringify(data);
633
+ const payload = safeJsonStringify(data);
616
634
  const url = `${this.host}/batch/`;
617
635
  const gzippedPayload = this.disableCompression ? null : await gzipCompress(payload, this.isDebug);
618
636
  const fetchOptions = {
@@ -629,7 +647,7 @@ class PostHogCoreStateless {
629
647
  const retryOptions = {
630
648
  retryCheck: (err)=>{
631
649
  if (isPostHogFetchContentTooLargeError(err)) return false;
632
- return isPostHogFetchError(err);
650
+ return isPostHogFetchRetryableError(err);
633
651
  }
634
652
  };
635
653
  try {
@@ -673,7 +691,7 @@ class PostHogCoreStateless {
673
691
  await this.fetchWithRetry(url, fetchOptions, {
674
692
  retryCheck: (err)=>{
675
693
  if (isPostHogFetchContentTooLargeError(err)) return false;
676
- return isPostHogFetchError(err);
694
+ return isPostHogFetchRetryableError(err);
677
695
  }
678
696
  });
679
697
  return {
@@ -4,6 +4,7 @@ export declare function includes<T>(arr: T[], needle: T): boolean;
4
4
  export declare const trim: (str: string) => string;
5
5
  export declare const stripLeadingDollar: (s: string) => string;
6
6
  export declare function isDistinctIdStringLike(value: string): boolean;
7
+ export declare function safeJsonStringify(value: unknown): string;
7
8
  /**
8
9
  * Creates a hash string from distinct_id and person properties.
9
10
  * Used to detect if person properties have changed to avoid duplicate $set events.
@@ -1 +1 @@
1
- {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../src/utils/string-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;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G,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,EACjD,uBAAuB,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GACpD,MAAM,CAMR"}
@@ -27,6 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  getPersonPropertiesHash: ()=>getPersonPropertiesHash,
28
28
  includes: ()=>includes,
29
29
  isDistinctIdStringLike: ()=>isDistinctIdStringLike,
30
+ safeJsonStringify: ()=>safeJsonStringify,
30
31
  stripLeadingDollar: ()=>stripLeadingDollar,
31
32
  trim: ()=>trim
32
33
  });
@@ -45,6 +46,24 @@ function isDistinctIdStringLike(value) {
45
46
  'distinctid'
46
47
  ].includes(value.toLowerCase());
47
48
  }
49
+ function safeJsonStringify(value) {
50
+ const ancestors = [];
51
+ return JSON.stringify(value, function(_key, replacementValue) {
52
+ if ('bigint' == typeof replacementValue) return replacementValue.toString();
53
+ if ('function' == typeof replacementValue || 'symbol' == typeof replacementValue) return;
54
+ if (replacementValue instanceof Error) return {
55
+ name: replacementValue.name,
56
+ message: replacementValue.message,
57
+ stack: replacementValue.stack
58
+ };
59
+ if (replacementValue && 'object' == typeof replacementValue) {
60
+ while(ancestors.length > 0 && ancestors[ancestors.length - 1] !== this)ancestors.pop();
61
+ if (ancestors.includes(replacementValue)) return '[Circular]';
62
+ ancestors.push(replacementValue);
63
+ }
64
+ return replacementValue;
65
+ }) ?? 'null';
66
+ }
48
67
  function deepSortKeys(value) {
49
68
  if (null === value || 'object' != typeof value) return value;
50
69
  if (Array.isArray(value)) return value.map(deepSortKeys);
@@ -63,12 +82,14 @@ function getPersonPropertiesHash(distinct_id, userPropertiesToSet, userPropertie
63
82
  exports.getPersonPropertiesHash = __webpack_exports__.getPersonPropertiesHash;
64
83
  exports.includes = __webpack_exports__.includes;
65
84
  exports.isDistinctIdStringLike = __webpack_exports__.isDistinctIdStringLike;
85
+ exports.safeJsonStringify = __webpack_exports__.safeJsonStringify;
66
86
  exports.stripLeadingDollar = __webpack_exports__.stripLeadingDollar;
67
87
  exports.trim = __webpack_exports__.trim;
68
88
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
69
89
  "getPersonPropertiesHash",
70
90
  "includes",
71
91
  "isDistinctIdStringLike",
92
+ "safeJsonStringify",
72
93
  "stripLeadingDollar",
73
94
  "trim"
74
95
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
@@ -13,6 +13,24 @@ function isDistinctIdStringLike(value) {
13
13
  'distinctid'
14
14
  ].includes(value.toLowerCase());
15
15
  }
16
+ function safeJsonStringify(value) {
17
+ const ancestors = [];
18
+ return JSON.stringify(value, function(_key, replacementValue) {
19
+ if ('bigint' == typeof replacementValue) return replacementValue.toString();
20
+ if ('function' == typeof replacementValue || 'symbol' == typeof replacementValue) return;
21
+ if (replacementValue instanceof Error) return {
22
+ name: replacementValue.name,
23
+ message: replacementValue.message,
24
+ stack: replacementValue.stack
25
+ };
26
+ if (replacementValue && 'object' == typeof replacementValue) {
27
+ while(ancestors.length > 0 && ancestors[ancestors.length - 1] !== this)ancestors.pop();
28
+ if (ancestors.includes(replacementValue)) return '[Circular]';
29
+ ancestors.push(replacementValue);
30
+ }
31
+ return replacementValue;
32
+ }) ?? 'null';
33
+ }
16
34
  function deepSortKeys(value) {
17
35
  if (null === value || 'object' != typeof value) return value;
18
36
  if (Array.isArray(value)) return value.map(deepSortKeys);
@@ -28,4 +46,4 @@ function getPersonPropertiesHash(distinct_id, userPropertiesToSet, userPropertie
28
46
  userPropertiesToSetOnce: userPropertiesToSetOnce ? deepSortKeys(userPropertiesToSetOnce) : void 0
29
47
  });
30
48
  }
31
- export { getPersonPropertiesHash, includes, isDistinctIdStringLike, stripLeadingDollar, trim };
49
+ export { getPersonPropertiesHash, includes, isDistinctIdStringLike, safeJsonStringify, stripLeadingDollar, trim };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/core",
3
- "version": "1.38.1",
3
+ "version": "1.39.2",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -1,4 +1,4 @@
1
- import { isArray, isNumber, isObject, isString } from '@/utils'
1
+ import { isArray, isNumber, isObject, isString, safeJsonStringify } from '@/utils'
2
2
 
3
3
  export const EXCEPTION_STEP_INTERNAL_FIELDS = {
4
4
  MESSAGE: '$message',
@@ -134,8 +134,10 @@ function normalizePositiveInteger(input: number | undefined, fallback: number):
134
134
  }
135
135
 
136
136
  function normalizeAndSerializeStep(step: ExceptionStep): { step: ExceptionStep; json: string } | undefined {
137
- const json = safeStringify(step)
138
- if (!json) {
137
+ let json: string
138
+ try {
139
+ json = safeJsonStringify(step)
140
+ } catch {
139
141
  return undefined
140
142
  }
141
143
 
@@ -166,45 +168,6 @@ function normalizeAndSerializeStep(step: ExceptionStep): { step: ExceptionStep;
166
168
  }
167
169
  }
168
170
 
169
- function safeStringify(value: unknown): string | undefined {
170
- const seen = new WeakSet<object>()
171
-
172
- try {
173
- return JSON.stringify(value, (_key, replacementValue: unknown) => {
174
- if (typeof replacementValue === 'bigint') {
175
- return replacementValue.toString()
176
- }
177
-
178
- if (typeof replacementValue === 'function' || typeof replacementValue === 'symbol') {
179
- return undefined
180
- }
181
-
182
- if (replacementValue instanceof Date) {
183
- return replacementValue.toISOString()
184
- }
185
-
186
- if (replacementValue instanceof Error) {
187
- return {
188
- name: replacementValue.name,
189
- message: replacementValue.message,
190
- stack: replacementValue.stack,
191
- }
192
- }
193
-
194
- if (replacementValue && typeof replacementValue === 'object') {
195
- if (seen.has(replacementValue)) {
196
- return '[Circular]'
197
- }
198
- seen.add(replacementValue)
199
- }
200
-
201
- return replacementValue
202
- })
203
- } catch {
204
- return undefined
205
- }
206
- }
207
-
208
171
  export function getUtf8ByteLength(value: string): number {
209
172
  if (typeof TextEncoder !== 'undefined') {
210
173
  return new TextEncoder().encode(value).length
@@ -34,6 +34,7 @@ import {
34
34
  STRING_FORMAT,
35
35
  createLogger,
36
36
  getEventUuid,
37
+ safeJsonStringify,
37
38
  } from './utils'
38
39
  import { uuidv7 } from './vendor/uuidv7'
39
40
  import {
@@ -126,6 +127,13 @@ function isPostHogFetchContentTooLargeError(err: unknown): err is PostHogFetchHt
126
127
  return typeof err === 'object' && err instanceof PostHogFetchHttpError && err.status === 413
127
128
  }
128
129
 
130
+ function isPostHogFetchRetryableError(err: unknown): err is PostHogFetchHttpError | PostHogFetchNetworkError {
131
+ if (err instanceof PostHogFetchHttpError) {
132
+ return err.status === 408 || err.status === 429 || err.status >= 500
133
+ }
134
+ return isPostHogFetchNetworkError(err)
135
+ }
136
+
129
137
  function isPostHogEventProperties(value: JsonType | undefined): value is PostHogEventProperties {
130
138
  return value !== null && typeof value === 'object' && !Array.isArray(value)
131
139
  }
@@ -250,7 +258,7 @@ export abstract class PostHogCoreStateless {
250
258
  this._retryOptions = {
251
259
  retryCount: options.fetchRetryCount ?? 3,
252
260
  retryDelay: options.fetchRetryDelay ?? 3000, // 3 seconds
253
- retryCheck: isPostHogFetchError,
261
+ retryCheck: isPostHogFetchRetryableError,
254
262
  }
255
263
  this.requestTimeout = options.requestTimeout ?? 10000 // 10 seconds
256
264
  this.featureFlagsRequestTimeoutMs = options.featureFlagsRequestTimeoutMs ?? 3000 // 3 seconds
@@ -515,6 +523,28 @@ export abstract class PostHogCoreStateless {
515
523
  })
516
524
  }
517
525
 
526
+ protected async groupIdentifyStatelessImmediate(
527
+ groupType: string,
528
+ groupKey: string | number,
529
+ groupProperties?: PostHogEventProperties,
530
+ options?: PostHogCaptureOptions,
531
+ distinctId?: string,
532
+ eventProperties?: PostHogEventProperties
533
+ ): Promise<void> {
534
+ const payload = this.buildPayload({
535
+ distinct_id: distinctId || `$${groupType}_${groupKey}`,
536
+ event: '$groupidentify',
537
+ properties: {
538
+ $group_type: groupType,
539
+ $group_key: groupKey,
540
+ $group_set: groupProperties || {},
541
+ ...(eventProperties || {}),
542
+ },
543
+ })
544
+
545
+ await this.sendImmediate('capture', payload, options)
546
+ }
547
+
518
548
  protected async getRemoteConfig(): Promise<PostHogRemoteConfig | undefined> {
519
549
  await this._initPromise
520
550
 
@@ -831,9 +861,8 @@ export abstract class PostHogCoreStateless {
831
861
  ): Promise<PostHogFeatureFlagDetails | undefined> {
832
862
  await this._initPromise
833
863
 
834
- const extraPayload: Record<string, any> = {}
835
- if (disableGeoip ?? this.disableGeoip) {
836
- extraPayload['geoip_disable'] = true
864
+ const extraPayload: Record<string, any> = {
865
+ geoip_disable: disableGeoip ?? this.disableGeoip,
837
866
  }
838
867
  if (flagKeysToEvaluate) {
839
868
  extraPayload['flag_keys_to_evaluate'] = flagKeysToEvaluate
@@ -1054,7 +1083,7 @@ export abstract class PostHogCoreStateless {
1054
1083
  data.historical_migration = true
1055
1084
  }
1056
1085
 
1057
- const payload = JSON.stringify(data)
1086
+ const payload = safeJsonStringify(data)
1058
1087
 
1059
1088
  const url = `${this.host}/batch/`
1060
1089
 
@@ -1250,7 +1279,7 @@ export abstract class PostHogCoreStateless {
1250
1279
  data.historical_migration = true
1251
1280
  }
1252
1281
 
1253
- const payload = JSON.stringify(data)
1282
+ const payload = safeJsonStringify(data)
1254
1283
 
1255
1284
  const url = `${this.host}/batch/`
1256
1285
 
@@ -1271,8 +1300,8 @@ export abstract class PostHogCoreStateless {
1271
1300
  if (isPostHogFetchContentTooLargeError(err)) {
1272
1301
  return false
1273
1302
  }
1274
- // otherwise, retry on network errors
1275
- return isPostHogFetchError(err)
1303
+ // otherwise, retry on transient HTTP and network errors
1304
+ return isPostHogFetchRetryableError(err)
1276
1305
  },
1277
1306
  }
1278
1307
 
@@ -1345,7 +1374,7 @@ export abstract class PostHogCoreStateless {
1345
1374
  if (isPostHogFetchContentTooLargeError(err)) {
1346
1375
  return false
1347
1376
  }
1348
- return isPostHogFetchError(err)
1377
+ return isPostHogFetchRetryableError(err)
1349
1378
  },
1350
1379
  })
1351
1380
  return { kind: 'ok' }
@@ -1,6 +1,43 @@
1
- import { getPersonPropertiesHash } from './string-utils'
1
+ import { getPersonPropertiesHash, safeJsonStringify } from './string-utils'
2
2
 
3
3
  describe('string-utils', () => {
4
+ describe('safeJsonStringify', () => {
5
+ it.each([
6
+ [
7
+ 'replaces circular references',
8
+ () => {
9
+ const circular: Record<string, any> = { foo: 'bar' }
10
+ circular.self = circular
11
+ return {
12
+ value: circular,
13
+ expected: { foo: 'bar', self: '[Circular]' },
14
+ }
15
+ },
16
+ ],
17
+ [
18
+ 'preserves shared non-circular references',
19
+ () => {
20
+ const shared = { id: 1 }
21
+ return {
22
+ value: { a: shared, b: shared },
23
+ expected: { a: { id: 1 }, b: { id: 1 } },
24
+ }
25
+ },
26
+ ],
27
+ [
28
+ 'serializes bigint values as strings',
29
+ () => ({
30
+ value: { count: BigInt(123) },
31
+ expected: { count: '123' },
32
+ }),
33
+ ],
34
+ ])('%s', (_description, buildCase) => {
35
+ const { value, expected } = buildCase()
36
+
37
+ expect(JSON.parse(safeJsonStringify(value))).toEqual(expected)
38
+ })
39
+ })
40
+
4
41
  describe('getPersonPropertiesHash', () => {
5
42
  it('should return consistent hash regardless of top-level key order', () => {
6
43
  const hash1 = getPersonPropertiesHash('user-1', { b: 'value-b', a: 'value-a' })