@shware/analytics 16.5.0 → 16.5.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/dist/link/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["fetch","config"],"sources":["../../src/link/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport type { CreateLinkDTO } from '../schema/index';\nimport { config } from '../setup/index';\n\nexport interface Link
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["fetch","config"],"sources":["../../src/link/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport type { CreateLinkDTO } from '../schema/index';\nimport { config } from '../setup/index';\n\n/** A stored link as the server answers it: a tag the link was created without comes back `null`. */\nexport interface Link {\n id: string;\n created_at: string;\n url: string;\n utm_source: string;\n utm_medium: string;\n utm_campaign: string;\n utm_id?: string | null;\n utm_term?: string | null;\n utm_content?: string | null;\n utm_source_platform?: string | null;\n utm_creative_format?: string | null;\n utm_marketing_tactic?: string | null;\n}\n\nexport async function createLink(dto: CreateLinkDTO) {\n const response = await fetch(`${config.endpoint}/links`, {\n method: 'POST',\n credentials: 'include',\n headers: await config.getHeaders(),\n body: JSON.stringify(dto),\n });\n\n if (!response.ok) {\n throw new Error(`Failed to create link: ${response.status} ${await response.text()}`);\n }\n return response.json() as Promise<Link>;\n}\n\n/**\n * The link a `?s=` id names. `null` when the server says there is none (a 4xx: a mistyped or\n * expired id, or a `?s=` that was never a link id): that answer will not change while the page is\n * open, so callers cache it. A 5xx or a network failure, once the retrying `fetch` gives up, is\n * thrown instead — the link may well exist, so a caller should look it up again later rather than\n * remember \"no link\".\n */\nexport async function getLink(id: string): Promise<Link | null> {\n const response = await fetch(`${config.endpoint}/links/${id}`, {\n method: 'GET',\n credentials: 'include',\n headers: await config.getHeaders(),\n });\n if (response.ok) return (await response.json()) as Link;\n const detail = `${response.status} ${await response.text()}`;\n if (response.status >= 400 && response.status < 500) {\n console.error(`No link(${id}): ${detail}`);\n return null;\n }\n throw new Error(`Failed to get link(${id}): ${detail}`);\n}\n"],"mappings":";;;;AAoBA,eAAsB,WAAW,KAAoB;CACnD,MAAM,WAAW,OAAA,GAAMA,cAAAA,MAAAA,CAAM,GAAGC,oBAAAA,OAAO,SAAS,SAAS;EACvD,QAAQ;EACR,aAAa;EACb,SAAS,MAAMA,oBAAAA,OAAO,WAAW;EACjC,MAAM,KAAK,UAAU,GAAG;CAC1B,CAAC;CAED,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,0BAA0B,SAAS,OAAO,GAAG,MAAM,SAAS,KAAK,GAAG;CAEtF,OAAO,SAAS,KAAK;AACvB;;;;;;;;AASA,eAAsB,QAAQ,IAAkC;CAC9D,MAAM,WAAW,OAAA,GAAMD,cAAAA,MAAAA,CAAM,GAAGC,oBAAAA,OAAO,SAAS,SAAS,MAAM;EAC7D,QAAQ;EACR,aAAa;EACb,SAAS,MAAMA,oBAAAA,OAAO,WAAW;CACnC,CAAC;CACD,IAAI,SAAS,IAAI,OAAQ,MAAM,SAAS,KAAK;CAC7C,MAAM,SAAS,GAAG,SAAS,OAAO,GAAG,MAAM,SAAS,KAAK;CACzD,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAAK;EACnD,QAAQ,MAAM,WAAW,GAAG,KAAK,QAAQ;EACzC,OAAO;CACT;CACA,MAAM,IAAI,MAAM,sBAAsB,GAAG,KAAK,QAAQ;AACxD"}
|
package/dist/link/index.d.cts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { CreateLinkDTO } from "../schema/index.cjs";
|
|
2
|
-
|
|
2
|
+
/** A stored link as the server answers it: a tag the link was created without comes back `null`. */
|
|
3
|
+
export interface Link {
|
|
3
4
|
id: string;
|
|
4
5
|
created_at: string;
|
|
6
|
+
url: string;
|
|
7
|
+
utm_source: string;
|
|
8
|
+
utm_medium: string;
|
|
9
|
+
utm_campaign: string;
|
|
10
|
+
utm_id?: string | null;
|
|
11
|
+
utm_term?: string | null;
|
|
12
|
+
utm_content?: string | null;
|
|
13
|
+
utm_source_platform?: string | null;
|
|
14
|
+
utm_creative_format?: string | null;
|
|
15
|
+
utm_marketing_tactic?: string | null;
|
|
5
16
|
}
|
|
6
17
|
export declare function createLink(dto: CreateLinkDTO): Promise<Link>;
|
|
7
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/link/index.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/link/index.ts"],"mappings":";;iBAKiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;wBAGoB,WAAW,KAAK,gBAAa,QAAA;;;;;;;;wBAqB7B,QAAQ,aAAa,QAAQ"}
|
package/dist/link/index.d.mts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { CreateLinkDTO } from "../schema/index.mjs";
|
|
2
|
-
|
|
2
|
+
/** A stored link as the server answers it: a tag the link was created without comes back `null`. */
|
|
3
|
+
export interface Link {
|
|
3
4
|
id: string;
|
|
4
5
|
created_at: string;
|
|
6
|
+
url: string;
|
|
7
|
+
utm_source: string;
|
|
8
|
+
utm_medium: string;
|
|
9
|
+
utm_campaign: string;
|
|
10
|
+
utm_id?: string | null;
|
|
11
|
+
utm_term?: string | null;
|
|
12
|
+
utm_content?: string | null;
|
|
13
|
+
utm_source_platform?: string | null;
|
|
14
|
+
utm_creative_format?: string | null;
|
|
15
|
+
utm_marketing_tactic?: string | null;
|
|
5
16
|
}
|
|
6
17
|
export declare function createLink(dto: CreateLinkDTO): Promise<Link>;
|
|
7
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/link/index.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/link/index.ts"],"mappings":";;iBAKiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;wBAGoB,WAAW,KAAK,gBAAa,QAAA;;;;;;;;wBAqB7B,QAAQ,aAAa,QAAQ"}
|
package/dist/link/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/link/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport type { CreateLinkDTO } from '../schema/index';\nimport { config } from '../setup/index';\n\nexport interface Link
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/link/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport type { CreateLinkDTO } from '../schema/index';\nimport { config } from '../setup/index';\n\n/** A stored link as the server answers it: a tag the link was created without comes back `null`. */\nexport interface Link {\n id: string;\n created_at: string;\n url: string;\n utm_source: string;\n utm_medium: string;\n utm_campaign: string;\n utm_id?: string | null;\n utm_term?: string | null;\n utm_content?: string | null;\n utm_source_platform?: string | null;\n utm_creative_format?: string | null;\n utm_marketing_tactic?: string | null;\n}\n\nexport async function createLink(dto: CreateLinkDTO) {\n const response = await fetch(`${config.endpoint}/links`, {\n method: 'POST',\n credentials: 'include',\n headers: await config.getHeaders(),\n body: JSON.stringify(dto),\n });\n\n if (!response.ok) {\n throw new Error(`Failed to create link: ${response.status} ${await response.text()}`);\n }\n return response.json() as Promise<Link>;\n}\n\n/**\n * The link a `?s=` id names. `null` when the server says there is none (a 4xx: a mistyped or\n * expired id, or a `?s=` that was never a link id): that answer will not change while the page is\n * open, so callers cache it. A 5xx or a network failure, once the retrying `fetch` gives up, is\n * thrown instead — the link may well exist, so a caller should look it up again later rather than\n * remember \"no link\".\n */\nexport async function getLink(id: string): Promise<Link | null> {\n const response = await fetch(`${config.endpoint}/links/${id}`, {\n method: 'GET',\n credentials: 'include',\n headers: await config.getHeaders(),\n });\n if (response.ok) return (await response.json()) as Link;\n const detail = `${response.status} ${await response.text()}`;\n if (response.status >= 400 && response.status < 500) {\n console.error(`No link(${id}): ${detail}`);\n return null;\n }\n throw new Error(`Failed to get link(${id}): ${detail}`);\n}\n"],"mappings":";;;AAoBA,eAAsB,WAAW,KAAoB;CACnD,MAAM,WAAW,MAAM,MAAM,GAAG,OAAO,SAAS,SAAS;EACvD,QAAQ;EACR,aAAa;EACb,SAAS,MAAM,OAAO,WAAW;EACjC,MAAM,KAAK,UAAU,GAAG;CAC1B,CAAC;CAED,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,0BAA0B,SAAS,OAAO,GAAG,MAAM,SAAS,KAAK,GAAG;CAEtF,OAAO,SAAS,KAAK;AACvB;;;;;;;;AASA,eAAsB,QAAQ,IAAkC;CAC9D,MAAM,WAAW,MAAM,MAAM,GAAG,OAAO,SAAS,SAAS,MAAM;EAC7D,QAAQ;EACR,aAAa;EACb,SAAS,MAAM,OAAO,WAAW;CACnC,CAAC;CACD,IAAI,SAAS,IAAI,OAAQ,MAAM,SAAS,KAAK;CAC7C,MAAM,SAAS,GAAG,SAAS,OAAO,GAAG,MAAM,SAAS,KAAK;CACzD,IAAI,SAAS,UAAU,OAAO,SAAS,SAAS,KAAK;EACnD,QAAQ,MAAM,WAAW,GAAG,KAAK,QAAQ;EACzC,OAAO;CACT;CACA,MAAM,IAAI,MAAM,sBAAsB,GAAG,KAAK,QAAQ;AACxD"}
|