@xylabs/profile 7.0.2 → 7.0.4

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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ > **Deprecated.** Use [`@ariestools/sdk`](../../ariestools-sdk/README.md) instead. This package is a backward-compatibility re-export shim.
2
+
1
3
  [![logo][]](https://xylabs.com)
2
4
 
3
5
  # @xylabs/profile
@@ -12,25 +14,25 @@
12
14
  Using npm:
13
15
 
14
16
  ```sh
15
- npm install {{name}}
17
+ npm install @xylabs/profile
16
18
  ```
17
19
 
18
20
  Using yarn:
19
21
 
20
22
  ```sh
21
- yarn add {{name}}
23
+ yarn add @xylabs/profile
22
24
  ```
23
25
 
24
26
  Using pnpm:
25
27
 
26
28
  ```sh
27
- pnpm add {{name}}
29
+ pnpm add @xylabs/profile
28
30
  ```
29
31
 
30
32
  Using bun:
31
33
 
32
34
  ```sh
33
- bun add {{name}}
35
+ bun add @xylabs/profile
34
36
  ```
35
37
 
36
38
 
@@ -1,2 +1,2 @@
1
- export * from './profiler.ts';
1
+ export * from '@ariestools/sdk/profile';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA"}
@@ -1,37 +1,3 @@
1
- // src/profiler.ts
2
- var createProfiler = () => {
3
- return {};
4
- };
5
- var profile = (profiler, name) => {
6
- const timeData = profiler[name] ?? [];
7
- timeData.push(Date.now());
8
- profiler[name] = timeData;
9
- };
10
- var profileReport = (profiler) => {
11
- let lowest = Date.now();
12
- let highest = 0;
13
- const results = Object.entries(profiler).reduce((prev, [name, readings]) => {
14
- const start = readings.at(0);
15
- if (start !== void 0) {
16
- if (start < lowest) {
17
- lowest = start;
18
- }
19
- const end = readings.at(-1) ?? Date.now();
20
- if (end > highest) {
21
- highest = end;
22
- }
23
- prev[name] = end - start;
24
- }
25
- return prev;
26
- }, {});
27
- if (highest > 0) {
28
- results["-all-"] = highest - lowest;
29
- }
30
- return results;
31
- };
32
- export {
33
- createProfiler,
34
- profile,
35
- profileReport
36
- };
1
+ // src/index.ts
2
+ export * from "@ariestools/sdk/profile";
37
3
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/profiler.ts"],
4
- "sourcesContent": ["/** A record of named timing entries, where each key maps to an array of timestamps. */\nexport type Profiler = Record<string, number[]>\n\n/** Creates a new empty profiler instance. */\nexport const createProfiler = (): Profiler => {\n return {}\n}\n\n/**\n * Records a timestamp for the given profile name.\n * @param profiler - The profiler instance to record into.\n * @param name - The name of the timing entry.\n */\nexport const profile = (profiler: Profiler, name: string) => {\n const timeData = profiler[name] ?? []\n timeData.push(Date.now())\n profiler[name] = timeData\n}\n\n/**\n * Generates a report of elapsed times for each profiled entry.\n * @param profiler - The profiler instance to report on.\n * @returns A record mapping each profile name to its elapsed time in milliseconds, plus a '-all-' total.\n */\nexport const profileReport = (profiler: Profiler) => {\n let lowest = Date.now()\n let highest = 0\n // eslint-disable-next-line unicorn/no-array-reduce\n const results = Object.entries(profiler).reduce<Record<string, number>>((prev, [name, readings]) => {\n const start = readings.at(0)\n if (start !== undefined) {\n if (start < lowest) {\n lowest = start\n }\n const end = readings.at(-1) ?? Date.now()\n if (end > highest) {\n highest = end\n }\n prev[name] = end - start\n }\n return prev\n }, {})\n if (highest > 0) {\n results['-all-'] = highest - lowest\n }\n return results\n}\n"],
5
- "mappings": ";AAIO,IAAM,iBAAiB,MAAgB;AAC5C,SAAO,CAAC;AACV;AAOO,IAAM,UAAU,CAAC,UAAoB,SAAiB;AAC3D,QAAM,WAAW,SAAS,IAAI,KAAK,CAAC;AACpC,WAAS,KAAK,KAAK,IAAI,CAAC;AACxB,WAAS,IAAI,IAAI;AACnB;AAOO,IAAM,gBAAgB,CAAC,aAAuB;AACnD,MAAI,SAAS,KAAK,IAAI;AACtB,MAAI,UAAU;AAEd,QAAM,UAAU,OAAO,QAAQ,QAAQ,EAAE,OAA+B,CAAC,MAAM,CAAC,MAAM,QAAQ,MAAM;AAClG,UAAM,QAAQ,SAAS,GAAG,CAAC;AAC3B,QAAI,UAAU,QAAW;AACvB,UAAI,QAAQ,QAAQ;AAClB,iBAAS;AAAA,MACX;AACA,YAAM,MAAM,SAAS,GAAG,EAAE,KAAK,KAAK,IAAI;AACxC,UAAI,MAAM,SAAS;AACjB,kBAAU;AAAA,MACZ;AACA,WAAK,IAAI,IAAI,MAAM;AAAA,IACrB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,MAAI,UAAU,GAAG;AACf,YAAQ,OAAO,IAAI,UAAU;AAAA,EAC/B;AACA,SAAO;AACT;",
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["export * from '@ariestools/sdk/profile'\n"],
5
+ "mappings": ";AAAA,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- export type { Profiler } from './profiler.ts';
1
+ export type * from '@ariestools/sdk/profile/model';
2
2
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAAA,mBAAmB,+BAA+B,CAAA"}
package/package.json CHANGED
@@ -1,10 +1,8 @@
1
1
  {
2
2
  "name": "@xylabs/profile",
3
- "version": "7.0.2",
4
- "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
3
+ "version": "7.0.4",
4
+ "description": "DEPRECATED use @ariestools/sdk/profile. Backward-compatibility re-export shim.",
5
5
  "keywords": [
6
- "profile",
7
- "profiler",
8
6
  "xylabs",
9
7
  "utility",
10
8
  "typescript",
@@ -32,11 +30,11 @@
32
30
  "types": "./dist/neutral/index.d.ts",
33
31
  "default": "./dist/neutral/index.mjs"
34
32
  },
33
+ "./package.json": "./package.json",
35
34
  "./model": {
36
35
  "types": "./dist/neutral/model.d.ts",
37
36
  "default": "./dist/neutral/model.mjs"
38
- },
39
- "./package.json": "./package.json"
37
+ }
40
38
  },
41
39
  "files": [
42
40
  "dist",
@@ -45,20 +43,32 @@
45
43
  "!**/*.test.*",
46
44
  "README.md"
47
45
  ],
46
+ "dependencies": {
47
+ "@ariestools/sdk": "~7.0.4"
48
+ },
48
49
  "devDependencies": {
49
- "@xylabs/toolchain": "^8.5.3",
50
- "@xylabs/tsconfig": "^8.5.3",
50
+ "@opentelemetry/api": "^1.9.1",
51
+ "@opentelemetry/sdk-trace-base": "^2.8.0",
52
+ "@xylabs/toolchain": "^8.5.11",
53
+ "@xylabs/tsconfig": "^8.5.11",
54
+ "async-mutex": "^0.5.0",
51
55
  "browserslist": "4.28.4",
52
56
  "eslint": "^10.6.0",
53
57
  "eslint-import-resolver-typescript": "^4.4.5",
54
58
  "typescript": "^6.0.3",
55
- "vite": "^8.1.0",
56
- "vitest": "^4.1.9"
59
+ "zod": "^4.4.3"
60
+ },
61
+ "peerDependencies": {
62
+ "@opentelemetry/api": "^1.9",
63
+ "@opentelemetry/sdk-trace-base": "^2.7",
64
+ "async-mutex": "^0.5",
65
+ "zod": "^4.4"
57
66
  },
58
67
  "engines": {
59
68
  "node": ">=18"
60
69
  },
61
70
  "publishConfig": {
62
71
  "access": "public"
63
- }
72
+ },
73
+ "deprecated": "Use @ariestools/sdk/profile instead. @xylabs/profile is a compatibility shim only and will not receive further updates."
64
74
  }
@@ -1,17 +0,0 @@
1
- /** A record of named timing entries, where each key maps to an array of timestamps. */
2
- export type Profiler = Record<string, number[]>;
3
- /** Creates a new empty profiler instance. */
4
- export declare const createProfiler: () => Profiler;
5
- /**
6
- * Records a timestamp for the given profile name.
7
- * @param profiler - The profiler instance to record into.
8
- * @param name - The name of the timing entry.
9
- */
10
- export declare const profile: (profiler: Profiler, name: string) => void;
11
- /**
12
- * Generates a report of elapsed times for each profiled entry.
13
- * @param profiler - The profiler instance to report on.
14
- * @returns A record mapping each profile name to its elapsed time in milliseconds, plus a '-all-' total.
15
- */
16
- export declare const profileReport: (profiler: Profiler) => Record<string, number>;
17
- //# sourceMappingURL=profiler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["../../src/profiler.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAE/C,6CAA6C;AAC7C,eAAO,MAAM,cAAc,QAAO,QAEjC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,QAAQ,EAAE,MAAM,MAAM,SAIvD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,QAAQ,2BAsB/C,CAAA"}