@supersdk/jssdk 1.0.0 → 3.0.5-SNAPSHOT

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.
@@ -0,0 +1,93 @@
1
+ {
2
+ "schema": "supersdk.experiment.contract",
3
+ "contract": 1,
4
+ "algo": {
5
+ "id": "b1",
6
+ "hash": "sha256",
7
+ "separator": ":",
8
+ "prefix_bytes": 4,
9
+ "byte_order": "big",
10
+ "buckets": 10000,
11
+ "definition": "u = be_u32(SHA-256(utf8(salt) || ':' || utf8(device_id))[0..4]); bucket = floor(u * 10000 / 2^32)"
12
+ },
13
+ "salt_pattern": "^[a-z0-9]{16}$",
14
+ "experiment_key_pattern": "^[a-z][a-z0-9_]{1,39}$",
15
+ "variant_key_pattern": "^[a-z][a-z0-9_]{0,19}$",
16
+ "namespace_pattern": "^[a-z][a-z0-9_]{1,31}$",
17
+ "default_namespace": "default",
18
+ "sides": ["client", "server"],
19
+ "default_side": "client",
20
+ "limits": {
21
+ "variants_min": 2,
22
+ "variants_max": 10,
23
+ "payload_max_bytes": 8192,
24
+ "active_experiments_per_env": 2000,
25
+ "active_experiments_per_namespace": 200,
26
+ "namespaces_per_request": 10,
27
+ "assign_body_max_bytes": 16384,
28
+ "custom_attributes_max": 20,
29
+ "exp_vids_max": 500,
30
+ "overrides_devices_per_env": 2000,
31
+ "overrides_per_device": 50,
32
+ "device_id_max_chars": 256,
33
+ "attribute_key_max_chars": 64,
34
+ "attribute_value_max_chars": 256,
35
+ "audience_conditions_max": 20
36
+ },
37
+ "stale_after_sec": 604800,
38
+ "reasons": ["alloc", "override", "rollout", "unknown", "paused", "no_subject", "audience", "traffic", "not_loaded", "no_result"],
39
+ "assignment_reasons": ["alloc", "override", "rollout"],
40
+ "audience": {
41
+ "attributes": ["platform", "app_version", "country", "language", "channel", "install_time"],
42
+ "custom_prefix": "attr.",
43
+ "ops": {
44
+ "platform": ["in"],
45
+ "app_version": [">=", "<", "="],
46
+ "country": ["in", "not_in"],
47
+ "language": ["in", "not_in"],
48
+ "channel": ["in", "not_in"],
49
+ "install_time": [">=", "<"],
50
+ "attr.*": ["in", "not_in"]
51
+ },
52
+ "rules": [
53
+ "All conditions must hold (AND). A missing attribute, or an attribute whose value is the empty string, makes its condition false (also for not_in).",
54
+ "in / not_in take an array of strings and compare exactly (no trim, no case folding).",
55
+ "app_version compares dot-separated decimal segments as integers, padding missing segments with 0; any non-numeric segment on either side makes the condition false.",
56
+ "install_time is a millisecond timestamp (JSON number or decimal string); the condition value is a JSON integer."
57
+ ]
58
+ },
59
+ "evaluation_order": [
60
+ "1 experiment exists in the rules for the requested namespaces, else unknown",
61
+ "2 status rolled_out -> rollout variant, reason rollout (never exposed)",
62
+ "3 status running, else paused",
63
+ "4 device_id non-empty, else no_subject",
64
+ "5 override list hit -> reason override",
65
+ "6 every audience condition holds, else audience",
66
+ "7 bucket(layer_salt, device_id) inside one of the experiment's [start,end) ranges, else traffic",
67
+ "8 bucket(run_salt, device_id) picks the variant by cumulative weight_bp, reason alloc"
68
+ ],
69
+ "exposure_event": "$exp_exposure",
70
+ "event_param": "exp_vids",
71
+ "header": "X-Super-AB-Vids",
72
+ "query_param": "super_ab_vids",
73
+ "assign": {
74
+ "ss_paths": ["/superapi/v2/experiments/assign", "/api/v2/experiments/assign"],
75
+ "ca_upstream_path": "/api/public/v2/experiments/assign",
76
+ "method": "POST",
77
+ "env_resolution": "body.env > header X-Super-API-ENV > prod",
78
+ "request_fields": ["spid", "env", "device_id", "namespaces", "side", "attributes", "known_version"],
79
+ "response_fields": ["rules_version", "not_modified", "stale_after_sec", "assignments", "live_vids", "emergency_stopped"],
80
+ "not_modified_fields": ["rules_version", "not_modified"],
81
+ "assignment_fields": ["key", "vid", "run", "version", "type", "namespace", "variant", "payload", "layer_key", "reason"],
82
+ "error_codes": ["INVALID_REQUEST", "SPID_REQUIRED", "NOT_FOUND", "TOO_MANY_REQUESTS"]
83
+ },
84
+ "console_error_codes": [
85
+ "EXP_VERSION_CONFLICT",
86
+ "EXP_KEY_DUPLICATE",
87
+ "EXP_NOT_FOUND",
88
+ "EXP_INVALID_STATE",
89
+ "EXP_FROZEN_FIELD",
90
+ "EXP_LIMIT_EXCEEDED",
91
+ "EXP_INVALID_ARGUMENT"
92
+ ]
93
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "schema": "supersdk.jsb.golden-vectors",
3
+ "protocolVersion": { "major": 1, "minor": 0 },
4
+ "wire": [
5
+ { "id": "downloadFile", "callerArgs": ["https://example.invalid/a.zip", "{\"Authorization\":\"redacted\"}", "downloads/a.zip"], "requestId": "owner-1:req-1", "nativeArgs": ["owner-1:req-1", "https://example.invalid/a.zip", "{\"Authorization\":\"redacted\"}", "downloads/a.zip"] },
6
+ { "id": "share", "callerArgs": ["hello"], "nativeArgs": ["hello"] },
7
+ { "id": "openPage", "callerArgs": ["https://example.invalid/", "{\"showTitleBar\":true}"], "nativeArgs": ["https://example.invalid/", "{\"showTitleBar\":true}"] },
8
+ { "id": "publishToWebView", "callerArgs": ["*", "refresh", "{\"ok\":true}"], "nativeArgs": ["*", "refresh", "{\"ok\":true}"] },
9
+ { "id": "requestShortUrl", "callerArgs": ["{\"url\":\"https://example.invalid/\"}"], "requestId": "owner-1:req-2", "nativeArgs": ["{\"callbackId\":\"owner-1:req-2\",\"url\":\"https://example.invalid/\"}"] }
10
+ ],
11
+ "results": [
12
+ { "name": "success", "input": { "code": "SUCCESS", "data": { "ok": true } }, "outcome": { "type": "success" } },
13
+ { "name": "known_alias", "input": { "code": "INVALID_PARAMS", "message": "bad" }, "outcome": { "type": "error", "code": "INVALID_ARGUMENT", "retryable": false } },
14
+ { "name": "unknown_provider", "input": { "code": "PAYMENT_VENDOR_42", "message": "private" }, "outcome": { "type": "error", "code": "BRIDGE_ERROR", "nativeCode": "UNKNOWN", "retryable": false } },
15
+ { "name": "missing_code", "input": { "data": null }, "outcome": { "type": "error", "code": "PROTOCOL_MISMATCH" } }
16
+ ],
17
+ "events": [
18
+ { "type": "BROADCAST", "key": "inventory.changed", "id": "broadcast" },
19
+ { "type": "WEBVIEW_MESSAGE", "key": "target-1", "id": "webviewMessage" },
20
+ { "type": "SYSTEM", "key": "onEnterForeground", "id": "system.onEnterForeground" },
21
+ { "type": "SYSTEM", "key": "onEnterBackground", "id": "system.onEnterBackground" }
22
+ ],
23
+ "negativeManifest": [
24
+ { "name": "reserved_bootstrap", "mutation": "method:getBridgeManifest", "reasonCode": "RESERVED_METHOD" },
25
+ { "name": "duplicate_method", "mutation": "duplicate:share", "reasonCode": "DUPLICATE_METHOD" },
26
+ { "name": "wrong_download_order", "mutation": "args:downloadFile", "reasonCode": "METHOD_SIGNATURE" },
27
+ { "name": "unsupported_major", "mutation": "major:2", "reasonCode": "UNSUPPORTED_MAJOR" }
28
+ ]
29
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "vectors": [
3
+ {"name":"minimal-js-exception","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e1","sequence":1,"emittedAtMs":0,"category":"errors","signal":"js_exception","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p"},"summary":{"errorClass":"unknown","locationClass":"unknown","count":1}}},
4
+ {"name":"resource-error","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e2","sequence":2,"emittedAtMs":1,"category":"errors","signal":"resource_error","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p"},"summary":{"resourceClass":"script","locationClass":"third_party","count":2}}},
5
+ {"name":"unhandled-rejection","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e3","sequence":3,"emittedAtMs":2,"category":"errors","signal":"unhandled_rejection","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p"},"summary":{"errorClass":"type_error","fingerprint":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef","count":3}}},
6
+ {"name":"web-vitals","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e4","sequence":4,"emittedAtMs":3,"category":"performance","signal":"web_vitals","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p"},"summary":{"count":1,"measurements":[{"metric":"FCP","value":1,"unit":"ms","availability":"available"},{"metric":"LCP","value":2,"unit":"ms","availability":"available"},{"metric":"CLS","value":0.1,"unit":"score","availability":"available"},{"metric":"INP","value":0,"unit":"ms","availability":"unavailable"}]}}},
7
+ {"name":"navigation","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e5","sequence":5,"emittedAtMs":4,"category":"performance","signal":"navigation","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p"},"summary":{"count":1,"measurements":[{"metric":"navigation","value":8,"unit":"ms","availability":"available"}]}}},
8
+ {"name":"jsb-performance","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e6","sequence":6,"emittedAtMs":5,"category":"performance","signal":"jsb_operation","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p","requestId":"r"},"summary":{"api":"device.getEnv","outcome":"success","latencyBucket":"lt10ms","count":1}}},
9
+ {"name":"jsb-error","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e7","sequence":7,"emittedAtMs":6,"category":"errors","signal":"jsb_operation","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"s","runtimePageId":"p","requestId":"r"},"summary":{"api":"device.getEnv","outcome":"timeout","latencyBucket":"gte10s","errorClass":"timeout","count":1}}},
10
+ {"name":"container-navigation-performance","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e8","sequence":8,"emittedAtMs":7,"category":"performance","signal":"container_navigation","platform":"android","context":{"sdkVersion":"2.0.0","containerSessionId":"cs","containerPageId":"cp"},"summary":{"state":"finished","outcome":"success","latencyBucket":"lt1s","count":1}}},
11
+ {"name":"container-navigation-error","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e9","sequence":9,"emittedAtMs":8,"category":"errors","signal":"container_navigation","platform":"ios","context":{"sdkVersion":"2.0.0","containerVersion":"v1","containerSessionId":"cs","containerPageId":"cp"},"summary":{"state":"failed","outcome":"failure","errorClass":"network","locationClass":"native","count":1}}},
12
+ {"name":"container-process","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"e10","sequence":10,"emittedAtMs":9,"category":"errors","signal":"container_process","platform":"android","context":{"sdkVersion":"2.0.0","containerSessionId":"cs","containerPageId":"cp"},"summary":{"state":"terminated","outcome":"terminated","errorClass":"process_terminated","count":1}}},
13
+ {"name":"maximum-legal","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","sequence":2147483647,"emittedAtMs":9007199254740991,"category":"errors","signal":"js_exception","platform":"web","context":{"sdkVersion":"ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss","runtimeSessionId":"rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr","runtimePageId":"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp"},"summary":{"errorClass":"syntax_error","fingerprint":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","locationClass":"first_party","count":2147483647}}},
14
+ {"name":"utf8-byte-boundary","envelope":{"schema":"supersdk.monitoring.v1","envelopeId":"界界界界界界界界界界界界界界界界界界界界界界界界界界aa","sequence":11,"emittedAtMs":10,"category":"errors","signal":"resource_error","platform":"web","context":{"sdkVersion":"2.0.0","runtimeSessionId":"会会会会会会会会会会会会会会会会会会会会会会会会会会aa","runtimePageId":"p"},"summary":{"resourceClass":"font","locationClass":"inline","count":1}}}
15
+ ]
16
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "wireSchema": "supersdk.monitoring.v1",
4
+ "categories": ["errors", "performance"],
5
+ "signals": ["js_exception", "resource_error", "unhandled_rejection", "web_vitals", "navigation", "jsb_operation", "container_navigation", "container_process"],
6
+ "platforms": ["web", "android", "ios"],
7
+ "states": ["started", "finished", "failed", "terminated", "restored", "unavailable"],
8
+ "outcomes": ["success", "cancelled", "timeout", "unsupported", "failure", "terminated", "unavailable"],
9
+ "latencyBuckets": ["lt10ms", "lt100ms", "lt1s", "lt10s", "gte10s", "unknown"],
10
+ "errorClasses": ["type_error", "range_error", "syntax_error", "network", "timeout", "unsupported", "native", "business", "process_terminated", "unknown"],
11
+ "locationClasses": ["inline", "first_party", "third_party", "native", "unknown"],
12
+ "resourceClasses": ["script", "style", "image", "font", "media", "other"],
13
+ "metrics": ["FCP", "LCP", "CLS", "INP", "navigation"],
14
+ "units": ["ms", "score"],
15
+ "availability": ["available", "unavailable"],
16
+ "contextFields": ["sdkVersion", "containerVersion", "webviewId", "runtimeSessionId", "runtimePageId", "containerSessionId", "containerPageId", "navigationId", "requestId"],
17
+ "summaryFields": ["api", "state", "outcome", "latencyBucket", "errorClass", "fingerprint", "locationClass", "resourceClass", "count", "measurements"],
18
+ "signalRules": {
19
+ "js_exception": [{"category":"errors","allowed":["errorClass","fingerprint","locationClass","count"],"required":["errorClass","locationClass","count"]}],
20
+ "resource_error": [{"category":"errors","allowed":["resourceClass","locationClass","count"],"required":["resourceClass","locationClass","count"]}],
21
+ "unhandled_rejection": [{"category":"errors","allowed":["errorClass","fingerprint","count"],"required":["errorClass","count"]}],
22
+ "web_vitals": [{"category":"performance","allowed":["count","measurements"],"required":["count","measurements"]}],
23
+ "navigation": [{"category":"performance","allowed":["count","measurements"],"required":["count","measurements"]}],
24
+ "jsb_operation": [
25
+ {"category":"performance","allowed":["api","outcome","latencyBucket","count"],"required":["api","outcome","latencyBucket","count"]},
26
+ {"category":"errors","allowed":["api","outcome","latencyBucket","errorClass","count"],"required":["api","outcome","latencyBucket","errorClass","count"]}
27
+ ],
28
+ "container_navigation": [
29
+ {"category":"performance","allowed":["state","outcome","latencyBucket","count"],"required":["state","outcome","latencyBucket","count"]},
30
+ {"category":"errors","allowed":["state","outcome","errorClass","locationClass","count"],"required":["state","outcome","errorClass","locationClass","count"]}
31
+ ],
32
+ "container_process": [{"category":"errors","allowed":["state","outcome","errorClass","count"],"required":["state","outcome","errorClass","count"]}]
33
+ },
34
+ "limits": {
35
+ "safeStringBytes": 64,
36
+ "idBytes": 80,
37
+ "measurements": 5,
38
+ "count": 2147483647,
39
+ "sequence": 2147483647
40
+ }
41
+ }