@metaobjectsdev/runtime-web 0.24.4 → 0.25.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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { formatCurrency, parseCurrency, minorUnitsFor } from "./currency.js";
2
2
  export { buildFilterQs } from "./filter-qs.js";
3
3
  export type { EntityFetcher, GridConfig } from "./fetcher.js";
4
+ export { joinBaseUrl } from "./join-base-url.js";
4
5
  export { buildGrid } from "./grid-from-metadata.js";
5
6
  export type { MetaColumn, MetaGrid } from "./grid-from-metadata.js";
6
7
  export { canvasToJpegBlob } from "./canvas-to-jpeg-blob.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Public API surface for @metaobjectsdev/runtime-web.
2
2
  export { formatCurrency, parseCurrency, minorUnitsFor } from "./currency.js";
3
3
  export { buildFilterQs } from "./filter-qs.js";
4
+ export { joinBaseUrl } from "./join-base-url.js";
4
5
  export { buildGrid } from "./grid-from-metadata.js";
5
6
  export { canvasToJpegBlob } from "./canvas-to-jpeg-blob.js";
6
7
  export { reencodeJpeg } from "./reencode-jpeg.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Join a client base URL to a generated entity-relative path.
3
+ *
4
+ * ONE implementation, shared by both client tiers on purpose. `@metaobjectsdev/tanstack`
5
+ * wraps `useEntityFetcher()` with it and `@metaobjectsdev/angular` wraps the
6
+ * `EntityFetcherToken`; implemented separately they would eventually disagree about a
7
+ * trailing slash, and the disagreement would surface as a 404 in one framework only.
8
+ *
9
+ * `baseUrl` is deliberately optional and empty-by-default — a same-origin app mounting
10
+ * routes at the root needs no base, which is also what `meta init` scaffolds
11
+ * (`apiPrefix: ""`). The value may be a path (`/api`) or a full origin
12
+ * (`https://api.example.com/v1`); both are just prefixes to this function.
13
+ *
14
+ * The path is passed through with only its leading separator normalized: a query string
15
+ * rides along untouched, because generated hooks build `?…` onto the path before calling
16
+ * the fetcher.
17
+ */
18
+ export declare function joinBaseUrl(baseUrl: string | undefined, path: string): string;
19
+ //# sourceMappingURL=join-base-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join-base-url.d.ts","sourceRoot":"","sources":["../src/join-base-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7E"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Join a client base URL to a generated entity-relative path.
3
+ *
4
+ * ONE implementation, shared by both client tiers on purpose. `@metaobjectsdev/tanstack`
5
+ * wraps `useEntityFetcher()` with it and `@metaobjectsdev/angular` wraps the
6
+ * `EntityFetcherToken`; implemented separately they would eventually disagree about a
7
+ * trailing slash, and the disagreement would surface as a 404 in one framework only.
8
+ *
9
+ * `baseUrl` is deliberately optional and empty-by-default — a same-origin app mounting
10
+ * routes at the root needs no base, which is also what `meta init` scaffolds
11
+ * (`apiPrefix: ""`). The value may be a path (`/api`) or a full origin
12
+ * (`https://api.example.com/v1`); both are just prefixes to this function.
13
+ *
14
+ * The path is passed through with only its leading separator normalized: a query string
15
+ * rides along untouched, because generated hooks build `?…` onto the path before calling
16
+ * the fetcher.
17
+ */
18
+ export function joinBaseUrl(baseUrl, path) {
19
+ if (baseUrl === undefined || baseUrl === "")
20
+ return path;
21
+ const base = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
22
+ const rest = path.startsWith("/") ? path : `/${path}`;
23
+ return `${base}${rest}`;
24
+ }
25
+ //# sourceMappingURL=join-base-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join-base-url.js","sourceRoot":"","sources":["../src/join-base-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B,EAAE,IAAY;IACnE,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACzD,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACpE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IACtD,OAAO,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;AAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/runtime-web",
3
- "version": "0.24.4",
3
+ "version": "0.25.0",
4
4
  "description": "Pure framework-agnostic browser core for metaobjects: currency, filter URL serialization, fetcher contract types.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@metaobjectsdev/metadata": "0.24.4",
48
+ "@metaobjectsdev/metadata": "0.25.0",
49
49
  "qs": "^6.13.0"
50
50
  },
51
51
  "devDependencies": {
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  export { formatCurrency, parseCurrency, minorUnitsFor } from "./currency.js";
3
3
  export { buildFilterQs } from "./filter-qs.js";
4
4
  export type { EntityFetcher, GridConfig } from "./fetcher.js";
5
+ export { joinBaseUrl } from "./join-base-url.js";
5
6
  export { buildGrid } from "./grid-from-metadata.js";
6
7
  export type { MetaColumn, MetaGrid } from "./grid-from-metadata.js";
7
8
  export { canvasToJpegBlob } from "./canvas-to-jpeg-blob.js";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Join a client base URL to a generated entity-relative path.
3
+ *
4
+ * ONE implementation, shared by both client tiers on purpose. `@metaobjectsdev/tanstack`
5
+ * wraps `useEntityFetcher()` with it and `@metaobjectsdev/angular` wraps the
6
+ * `EntityFetcherToken`; implemented separately they would eventually disagree about a
7
+ * trailing slash, and the disagreement would surface as a 404 in one framework only.
8
+ *
9
+ * `baseUrl` is deliberately optional and empty-by-default — a same-origin app mounting
10
+ * routes at the root needs no base, which is also what `meta init` scaffolds
11
+ * (`apiPrefix: ""`). The value may be a path (`/api`) or a full origin
12
+ * (`https://api.example.com/v1`); both are just prefixes to this function.
13
+ *
14
+ * The path is passed through with only its leading separator normalized: a query string
15
+ * rides along untouched, because generated hooks build `?…` onto the path before calling
16
+ * the fetcher.
17
+ */
18
+ export function joinBaseUrl(baseUrl: string | undefined, path: string): string {
19
+ if (baseUrl === undefined || baseUrl === "") return path;
20
+ const base = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
21
+ const rest = path.startsWith("/") ? path : `/${path}`;
22
+ return `${base}${rest}`;
23
+ }