@amplitude/amp-semantic 0.0.1 → 0.2.0-sr-bfcache-pageshow-snapshot.0
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/LICENSE +21 -0
- package/README.md +44 -0
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +6 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types.d.ts +16 -0
- package/lib/cjs/types.d.ts.map +1 -0
- package/lib/cjs/types.js +6 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/esm/index.d.ts +3 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types.d.ts +16 -0
- package/lib/esm/types.d.ts.map +1 -0
- package/lib/esm/types.js +3 -0
- package/lib/esm/types.js.map +1 -0
- package/package.json +31 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Amplitude Analytics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @amplitude/amp-semantic
|
|
2
|
+
|
|
3
|
+
Package foundation for semantic event capture in Amplitude. This increment establishes
|
|
4
|
+
workspace packaging, CommonJS/ESM builds, TypeScript declarations, linting, tests, and
|
|
5
|
+
the shared event envelope. It does not collect or emit events.
|
|
6
|
+
|
|
7
|
+
## Public contracts
|
|
8
|
+
|
|
9
|
+
- `SEMANTIC_VERSION`: payload envelope version (`1`).
|
|
10
|
+
- `SemanticIdentity`: `tab_id` and `document_id` correlation fields.
|
|
11
|
+
- `SemanticEventEnvelope<Name, Payload>`: a typed name, timestamp, and payload
|
|
12
|
+
containing the caller's fields plus version and identity.
|
|
13
|
+
|
|
14
|
+
No event families are defined or registered. The package has no browser listeners,
|
|
15
|
+
DOM observers, storage access, identity generation, capture runtime, or Session Replay
|
|
16
|
+
integration. It is not yet a usable capture SDK.
|
|
17
|
+
|
|
18
|
+
## Incremental implementation
|
|
19
|
+
|
|
20
|
+
1. **This PR:** package structure and shared envelope contracts.
|
|
21
|
+
2. **Context and visibility:** capture runtime, sampling/caps, identity generation,
|
|
22
|
+
recorders, event schemas, Session Replay integration, and a local test page.
|
|
23
|
+
3. **Dialog and notice:** rrweb mutation input, DOM enrichment, and feedback recorders.
|
|
24
|
+
4. Additional event families in later PRs.
|
|
25
|
+
|
|
26
|
+
The existing full implementation remains available in PR #2082. Each event increment
|
|
27
|
+
should add its contracts, implementation, documentation, and validation together.
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
From the repository root:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pnpm install
|
|
35
|
+
pnpm build
|
|
36
|
+
pnpm --filter @amplitude/amp-semantic typecheck
|
|
37
|
+
pnpm --filter @amplitude/amp-semantic test --runInBand
|
|
38
|
+
pnpm --filter @amplitude/amp-semantic lint
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The package build cleans `lib` before generating `lib/cjs` and `lib/esm`, avoiding stale
|
|
42
|
+
recorders when switching between incremental branches. Runtime dependencies are limited
|
|
43
|
+
to the workspace-standard TypeScript helper library; event-specific dependencies arrive
|
|
44
|
+
with their implementations.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEMANTIC_VERSION = void 0;
|
|
4
|
+
var types_1 = require("./types");
|
|
5
|
+
Object.defineProperty(exports, "SEMANTIC_VERSION", { enumerable: true, get: function () { return types_1.SEMANTIC_VERSION; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA","sourcesContent":["export { SEMANTIC_VERSION } from './types';\nexport type { SemanticIdentity, SemanticEventEnvelope } from './types';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Version of the shared semantic payload envelope. */
|
|
2
|
+
export declare const SEMANTIC_VERSION = 1;
|
|
3
|
+
/** Correlation identifiers supplied by a future capture host. */
|
|
4
|
+
export interface SemanticIdentity {
|
|
5
|
+
readonly tab_id: string;
|
|
6
|
+
readonly document_id: string;
|
|
7
|
+
}
|
|
8
|
+
/** Internal event envelope, independent of any event family or replay transport. */
|
|
9
|
+
export interface SemanticEventEnvelope<Name extends string, Payload extends object> {
|
|
10
|
+
name: Name;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
payload: Payload & SemanticIdentity & {
|
|
13
|
+
v: typeof SEMANTIC_VERSION;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,oFAAoF;AACpF,MAAM,WAAW,qBAAqB,CAAC,IAAI,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM;IAChF,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,gBAAgB,GAAG;QAAE,CAAC,EAAE,OAAO,gBAAgB,CAAA;KAAE,CAAC;CACtE"}
|
package/lib/cjs/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAC1C,QAAA,gBAAgB,GAAG,CAAC,CAAC","sourcesContent":["/** Version of the shared semantic payload envelope. */\nexport const SEMANTIC_VERSION = 1;\n\n/** Correlation identifiers supplied by a future capture host. */\nexport interface SemanticIdentity {\n readonly tab_id: string;\n readonly document_id: string;\n}\n\n/** Internal event envelope, independent of any event family or replay transport. */\nexport interface SemanticEventEnvelope<Name extends string, Payload extends object> {\n name: Name;\n timestamp: number;\n payload: Payload & SemanticIdentity & { v: typeof SEMANTIC_VERSION };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { SEMANTIC_VERSION } from './types';\nexport type { SemanticIdentity, SemanticEventEnvelope } from './types';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Version of the shared semantic payload envelope. */
|
|
2
|
+
export declare const SEMANTIC_VERSION = 1;
|
|
3
|
+
/** Correlation identifiers supplied by a future capture host. */
|
|
4
|
+
export interface SemanticIdentity {
|
|
5
|
+
readonly tab_id: string;
|
|
6
|
+
readonly document_id: string;
|
|
7
|
+
}
|
|
8
|
+
/** Internal event envelope, independent of any event family or replay transport. */
|
|
9
|
+
export interface SemanticEventEnvelope<Name extends string, Payload extends object> {
|
|
10
|
+
name: Name;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
payload: Payload & SemanticIdentity & {
|
|
13
|
+
v: typeof SEMANTIC_VERSION;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,oFAAoF;AACpF,MAAM,WAAW,qBAAqB,CAAC,IAAI,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM;IAChF,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,gBAAgB,GAAG;QAAE,CAAC,EAAE,OAAO,gBAAgB,CAAA;KAAE,CAAC;CACtE"}
|
package/lib/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,CAAC,IAAM,gBAAgB,GAAG,CAAC,CAAC","sourcesContent":["/** Version of the shared semantic payload envelope. */\nexport const SEMANTIC_VERSION = 1;\n\n/** Correlation identifiers supplied by a future capture host. */\nexport interface SemanticIdentity {\n readonly tab_id: string;\n readonly document_id: string;\n}\n\n/** Internal event envelope, independent of any event family or replay transport. */\nexport interface SemanticEventEnvelope<Name extends string, Payload extends object> {\n name: Name;\n timestamp: number;\n payload: Payload & SemanticIdentity & { v: typeof SEMANTIC_VERSION };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/amp-semantic",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0-sr-bfcache-pageshow-snapshot.0",
|
|
4
|
+
"description": "Shared package foundation for Amplitude semantic event capture",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "lib/cjs/index.js",
|
|
7
|
+
"module": "lib/esm/index.js",
|
|
8
|
+
"types": "lib/esm/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"files": [
|
|
11
|
+
"lib"
|
|
12
|
+
],
|
|
6
13
|
"publishConfig": {
|
|
7
14
|
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"tslib": "^2.4.1"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"rimraf": "^3.0.2"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"clean": "rimraf lib",
|
|
29
|
+
"build": "pnpm clean && pnpm build:es5 && pnpm build:esm",
|
|
30
|
+
"build:es5": "tsc -p tsconfig.es5.json",
|
|
31
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
32
|
+
"test": "jest",
|
|
33
|
+
"lint": "eslint '{src,test}/**/*.ts'",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
8
35
|
}
|
|
9
|
-
}
|
|
36
|
+
}
|