@siteping/server 0.0.0-stage → 0.1.1
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 +40 -2
- package/dist/concurrency.d.cts +14 -0
- package/dist/concurrency.d.ts +14 -0
- package/dist/deep-link.d.cts +14 -0
- package/dist/deep-link.d.ts +14 -0
- package/dist/email.d.cts +22 -0
- package/dist/email.d.ts +22 -0
- package/dist/errors.d.cts +55 -0
- package/dist/errors.d.ts +55 -0
- package/dist/filters.d.cts +82 -0
- package/dist/filters.d.ts +82 -0
- package/dist/i18n.d.cts +85 -0
- package/dist/i18n.d.ts +85 -0
- package/dist/index.cjs +1270 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +488 -0
- package/dist/index.d.ts +488 -0
- package/dist/index.js +1237 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.d.cts +317 -0
- package/dist/schema.d.ts +317 -0
- package/dist/screenshot-storage.d.cts +103 -0
- package/dist/screenshot-storage.d.ts +103 -0
- package/dist/siteping-core.d.cts +20 -0
- package/dist/siteping-core.d.ts +20 -0
- package/dist/store-helpers.d.cts +140 -0
- package/dist/store-helpers.d.ts +140 -0
- package/dist/type-utils.d.cts +66 -0
- package/dist/type-utils.d.ts +66 -0
- package/dist/types.d.cts +1206 -0
- package/dist/types.d.ts +1206 -0
- package/dist/wire.d.cts +68 -0
- package/dist/wire.d.ts +68 -0
- package/package.json +64 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General-purpose TypeScript utility types used across `@siteping/*`.
|
|
3
|
+
*
|
|
4
|
+
* These are kept dependency-free and re-exported from the package entry
|
|
5
|
+
* so adapters and integrators can rely on the same primitives the core
|
|
6
|
+
* uses internally.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Force TypeScript to expand a computed type into a flat object literal in
|
|
10
|
+
* tooltips and error messages. Purely cosmetic — same structural type, just
|
|
11
|
+
* easier to read.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* type Raw = Omit<FeedbackRecord, "annotations"> & { annotations: number };
|
|
15
|
+
* type Pretty = Prettify<Raw>; // displayed as a flat object
|
|
16
|
+
*/
|
|
17
|
+
export type Prettify<T> = {
|
|
18
|
+
[K in keyof T]: T[K];
|
|
19
|
+
} & {};
|
|
20
|
+
/**
|
|
21
|
+
* Returns `Y` when `A` is exactly assignable to `B` and vice-versa,
|
|
22
|
+
* otherwise `N`. Powers compile-time equality assertions.
|
|
23
|
+
*/
|
|
24
|
+
export type IfEquals<A, B, Y = true, N = false> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? Y : N;
|
|
25
|
+
/**
|
|
26
|
+
* Compile-time exact-type guard — resolves to `true` when `Actual` and
|
|
27
|
+
* `Expected` are identical, `never` otherwise. Assign the result to a
|
|
28
|
+
* `const _lock: AssertEqual<A, B> = true;` so any drift becomes a compile
|
|
29
|
+
* error at the declaration site.
|
|
30
|
+
*/
|
|
31
|
+
export type AssertEqual<Actual, Expected> = IfEquals<Actual, Expected, true, never>;
|
|
32
|
+
/**
|
|
33
|
+
* JSON-serialized shape of `T` — the wire form produced by `Response.json()`
|
|
34
|
+
* / `JSON.stringify`: `Date` becomes ISO `string` (nullability preserved),
|
|
35
|
+
* arrays are serialized element-wise, everything else is untouched.
|
|
36
|
+
*
|
|
37
|
+
* Used to derive the `*Response` API types from the `*Record` store types so
|
|
38
|
+
* the two can never drift: add a field to `FeedbackRecord` and
|
|
39
|
+
* `FeedbackResponse` follows automatically.
|
|
40
|
+
*/
|
|
41
|
+
export type Serialized<T> = {
|
|
42
|
+
[K in keyof T]: T[K] extends Date ? string : T[K] extends Date | null ? string | null : T[K] extends (infer U)[] ? Serialized<U>[] : T[K];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Read-only all the way down, for plain data that is deeply frozen at
|
|
46
|
+
* runtime: nested objects get read-only properties, arrays become
|
|
47
|
+
* `readonly` arrays.
|
|
48
|
+
*/
|
|
49
|
+
export type DeepReadonly<T> = T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
|
|
50
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
51
|
+
} : T;
|
|
52
|
+
/**
|
|
53
|
+
* Type guard that narrows `value` to a non-null `Record<PropertyKey, unknown>`.
|
|
54
|
+
* Useful when validating arbitrary inputs before reading fields.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isRecord(value: unknown): value is Record<PropertyKey, unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns true when `value` is an object that exposes the requested key.
|
|
59
|
+
* Type-narrows `value` so the property can be accessed without further
|
|
60
|
+
* casting — a strictly typed replacement for `"k" in obj`.
|
|
61
|
+
*
|
|
62
|
+
* Named after the standardised `Object.hasOwn` helper rather than the
|
|
63
|
+
* legacy `Object.prototype.hasOwnProperty`, which the linter forbids
|
|
64
|
+
* shadowing.
|
|
65
|
+
*/
|
|
66
|
+
export declare function hasOwn<K extends PropertyKey>(value: unknown, key: K): value is Record<K, unknown>;
|