@sheetxl/sdk 0.8.0-beta.2 → 0.8.0-beta.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.
Files changed (27) hide show
  1. package/browser/cjs/{BEnEDC1m546-gzWS.cjs → B5eE9jdzHkM8tFuQ.cjs} +1 -1
  2. package/browser/cjs/{CwCUa4IzGNGissLL.cjs → BNeaA3zuOokpev3O.cjs} +1 -1
  3. package/browser/cjs/Bjifbb6rRolOGtDI.cjs +1 -0
  4. package/browser/cjs/{KWQPie2u7AP69web.cjs → BuqhBOLW4GUYwVXx.cjs} +43 -43
  5. package/browser/cjs/{Dg3GaW0QWwnlqetX.cjs → CJK0UKBYYLMe5y7n.cjs} +1 -1
  6. package/browser/cjs/index.cjs +2 -2
  7. package/browser/esm/{DDojiE2-oycJ7qGi.mjs → Bo_UXn6gOo4WtFaK.mjs} +2 -2
  8. package/browser/esm/{Dq3sc4B_HQHBrT5N.mjs → CCiusSzUCYBTSrjh.mjs} +2 -2
  9. package/browser/esm/{BJ9hcZAGY8Tj5_9L.mjs → CLNdkRPXU9Vs9_D0.mjs} +1 -1
  10. package/browser/esm/{DOvCi3lf49To36WP.mjs → Cbmh2jP9H2-gYBQM.mjs} +2 -2
  11. package/browser/esm/{trwZArJQQq7K9kL7.mjs → CcB0KWKqtNYkSb4T.mjs} +2 -2
  12. package/browser/esm/{DEPT7zmpiMdZ-_qC.mjs → CrLATXO_z7wtfQdU.mjs} +4946 -4956
  13. package/browser/esm/{C8vpA2ZBtZf6w4nq.mjs → RKmI4uT6cEURNbC6.mjs} +2 -2
  14. package/browser/esm/index.mjs +7 -7
  15. package/node/esm/{O2cOO3xIynWUgOWe.mjs → B5aWdYZUUJ3I1yku.mjs} +1 -1
  16. package/node/esm/{CGWsQOMWdnDeF4dX.mjs → BUD7-kF0NUZGvJ71.mjs} +1 -1
  17. package/node/esm/{CressiwiIhxCVp1v.mjs → CXZXQq46kIHcA26q.mjs} +1 -1
  18. package/node/esm/{CL9MI-b6D9BmtVXW.mjs → DnPPf2PdWs2Hcaau.mjs} +1 -1
  19. package/node/esm/index.mjs +10915 -10835
  20. package/package.json +6 -6
  21. package/types/scripting-api.json +7085 -7082
  22. package/types/scripting.d.ts +35 -11
  23. package/types/src/lib/utils/utils.browser.d.ts +5 -0
  24. package/types/src/license/LicenseDetails.d.ts +1 -0
  25. package/types/src/license/LicenseManager.d.ts +4 -1
  26. package/types/src/license/license-key.d.ts +20 -0
  27. package/browser/cjs/4f5eoQQfV-V7LO2_.cjs +0 -1
@@ -97,11 +97,14 @@ declare global {
97
97
  /**
98
98
  * Add a resource ROOT, searched ahead of anything the packages ship.
99
99
  *
100
- * Re-declared here rather than re-exported straight from the seam, because a
101
- * `export { x } from '@sheetxl/utils/resource'` survives type emit into `LocaleResource.d.ts` — and
102
- * that subpath does not exist in the published `package.json`, so every consumer of this package's
103
- * types got TS2307. Note sdk gets away with the same seam only because it never re-exports a symbol
104
- * out of one; keep it that way here.
100
+ * In the browser this is required to load anything beyond the bundled default language — there is
101
+ * no implicit root. An app that stages resources with `ResourcesPlugin` (or `stageResources`) serves
102
+ * them at `/resources`, so it calls `addResourceRoot('/resources')`.
103
+ *
104
+ * May be called before or after packages load; already-registered packages re-discover their locales.
105
+ *
106
+ * @param root a URL prefix (browser) or directory (node) laid out as `<root>/<kind>/<pkg>/<relPath>`,
107
+ * or a custom {@link ResourceRoot}.
105
108
  */
106
109
  export function addResourceRoot(root: string | ResourceRoot): void;
107
110
 
@@ -2235,8 +2238,8 @@ declare global {
2235
2238
  */
2236
2239
  export function getLocaleProfile(tag: string, overrides?: LocaleProfileOverrides | null): LocaleProfile;
2237
2240
 
2238
- /** The current base (the browser default when unset). */
2239
- export function getLocaleResourceBase(): string;
2241
+ /** The configured base, or `null` when none has been set. */
2242
+ export function getLocaleResourceBase(): string | null;
2240
2243
 
2241
2244
  export function getScriptingApi(): Promise<ScriptingApi.Index>;
2242
2245
 
@@ -33843,6 +33846,7 @@ declare global {
33843
33846
  export interface LicenseDetails {
33844
33847
  getLicensee(): string | null;
33845
33848
  getExpiration(): Date | null;
33849
+ getRuntimes(): ('browser' | 'server')[];
33846
33850
  getDomains(): string[];
33847
33851
  getCpuCount(): number;
33848
33852
  getMemory(): number;
@@ -33914,12 +33918,25 @@ declare global {
33914
33918
  */
33915
33919
  export function listLocaleResources(pkg: string, fromUrl?: string): Promise<ResourceIndex[]>;
33916
33920
 
33921
+ /**
33922
+ * List the resource indexes published for a package under a resource kind.
33923
+ *
33924
+ * @param kind The resource namespace, such as `'locales'` or `'templates'`.
33925
+ * @param pkg The package the resources belong to.
33926
+ * @param base A base to search after the user resource roots, or `null` for none.
33927
+ * @param fromUrl Node only. The `import.meta.url` to locate the package's own resources from.
33928
+ */
33929
+ export function listResources(kind: string, pkg: string, base: string | null, fromUrl?: string): Promise<ResourceIndex[]>;
33930
+
33917
33931
  export class LM {
33918
33932
  constructor();
33919
33933
  /**
33920
33934
  * Set the license key provided by SheetXL.
33921
33935
  * @remarks
33922
- * The license key can also be provided via a file named `sheetxl.lic` in the root of the web server.
33936
+ * Without a call to this, the key is looked for where it runs:
33937
+ * - In a browser, a file named `sheetxl.lic` served beside the page.
33938
+ * - Outside a browser (Node, Bun, Deno, CI), the `SHEETXL_LICENSE_KEY` environment variable, then
33939
+ * the key saved by `sheetxl license activate`.
33923
33940
  *
33924
33941
  * @param licenseKey The license key as a string.
33925
33942
  * @param force If set to `true` will replace an existing key.
@@ -34674,6 +34691,13 @@ declare global {
34674
34691
  [K in keyof T]: Required<Pick<T, K>> & Partial<Record<Exclude<keyof T, K>, never>>;
34675
34692
  }[keyof T];
34676
34693
 
34694
+ /**
34695
+ * Listen for the set of places resources are loaded from changing — a root added or the base set.
34696
+ *
34697
+ * Locale discovery subscribes to this so a root added after a package registered still contributes.
34698
+ */
34699
+ export function onResourceRootsChange(listener: () => void): RemoveListener;
34700
+
34677
34701
  export interface OrientationFlags {
34678
34702
  vertical: boolean;
34679
34703
  horizontal: boolean;
@@ -35387,7 +35411,7 @@ declare global {
35387
35411
  export function resolveLocaleChain(tag: string, locales: Record<string, LocaleIndexEntry | undefined>): string[];
35388
35412
 
35389
35413
  /**
35390
- * Resolve a locale resource URL: `<base><pkg>/<relPath>`.
35414
+ * Resolve a locale resource URL: `<base><pkg>/<relPath>`, or `null` when no base is configured.
35391
35415
  *
35392
35416
  * Browser-shaped, and only describes the BASE — it does not account for resource roots, which may
35393
35417
  * outrank it. Use {@link fetchLocaleResource} to actually load.
@@ -35395,7 +35419,7 @@ declare global {
35395
35419
  * @param pkg the owning package id, e.g. `'@sheetxl/react'`
35396
35420
  * @param relPath the path within that package's `locales/`, e.g. `'de/model.msg.json'` or `'inherit.json'`
35397
35421
  */
35398
- export function resolveLocaleResource(pkg: string, relPath: string): string;
35422
+ export function resolveLocaleResource(pkg: string, relPath: string): string | null;
35399
35423
 
35400
35424
  /**
35401
35425
  * The log timeout in effect, in milliseconds: the first candidate that is a non-negative number,
@@ -35779,7 +35803,7 @@ declare global {
35779
35803
  /**
35780
35804
  * Set the base under which package locale resources are served.
35781
35805
  *
35782
- * In the browser this is a URL prefix (default `'/resources/locales/'`). In node it is a DIRECTORY.
35806
+ * In the browser this is a URL prefix, e.g. `'/resources/locales/'`. In node it is a DIRECTORY.
35783
35807
  * Unlike a resource ROOT it names the kind itself, so it holds `<pkg>/<relPath>` directly with no
35784
35808
  * `locales/` segment — leave it unset in node unless the host stages the files that way.
35785
35809
  */
@@ -21,6 +21,11 @@ export declare function getLocation(): string;
21
21
  * The OS platform, used by the `INFO("system")` formula.
22
22
  */
23
23
  export declare function getOS(): string;
24
+ /**
25
+ * The key in a `sheetxl.lic` served beside the page: its first line that is not blank or a `#`
26
+ * comment. A server that answers every path with its app page (a single-page app's fallback) sends
27
+ * HTML with a 200, so an HTML response is no key rather than an invalid one.
28
+ */
24
29
  export declare function findLicenseKey(): Promise<{
25
30
  key: string;
26
31
  from: string;
@@ -4,6 +4,7 @@
4
4
  export interface LicenseDetails {
5
5
  getLicensee(): string | null;
6
6
  getExpiration(): Date | null;
7
+ getRuntimes(): ('browser' | 'server')[];
7
8
  getDomains(): string[];
8
9
  getCpuCount(): number;
9
10
  getMemory(): number;
@@ -4,7 +4,10 @@ declare class LM {
4
4
  /**
5
5
  * Set the license key provided by SheetXL.
6
6
  * @remarks
7
- * The license key can also be provided via a file named `sheetxl.lic` in the root of the web server.
7
+ * Without a call to this, the key is looked for where it runs:
8
+ * - In a browser, a file named `sheetxl.lic` served beside the page.
9
+ * - Outside a browser (Node, Bun, Deno, CI), the `SHEETXL_LICENSE_KEY` environment variable, then
10
+ * the key saved by `sheetxl license activate`.
8
11
  *
9
12
  * @param licenseKey The license key as a string.
10
13
  * @param force If set to `true` will replace an existing key.
@@ -1,15 +1,30 @@
1
1
  import { LicenseDetails } from './LicenseDetails';
2
+ /**
3
+ * Where a license runs. `browser` is any page (checked against its origin); `server` is any
4
+ * JavaScript runtime outside a browser - Node, Bun, Deno, the CLI, a CI runner (checked against the
5
+ * machine).
6
+ */
7
+ export type LicenseRuntime = 'browser' | 'server';
8
+ export declare const LICENSE_RUNTIMES: readonly LicenseRuntime[];
2
9
  export interface Decoded {
3
10
  licensee?: string | null;
4
11
  type?: string;
5
12
  expiry?: number;
6
13
  developerCount?: number;
14
+ /** The runtimes the key covers; `undefined` for a key issued before runtimes were explicit. */
15
+ runtimes?: LicenseRuntime[];
7
16
  domains?: string[];
8
17
  fingerprint?: string | null;
9
18
  cpuCount?: number;
10
19
  memory?: number | null;
11
20
  features?: Record<string, any>[];
12
21
  }
22
+ /**
23
+ * The runtimes a decoded key covers. A key issued before runtimes were explicit covers `browser`
24
+ * when it has origins, and `server` unless its cpu and memory are both 0 (the old browser-only
25
+ * marker).
26
+ */
27
+ export declare function getRuntimes(decoded: Decoded): LicenseRuntime[];
13
28
  export interface LicenseAndKey {
14
29
  details: LicenseDetails;
15
30
  key: string;
@@ -19,6 +34,11 @@ export interface LicenseKeyDetails {
19
34
  type?: string;
20
35
  expiration?: string | null;
21
36
  developerCount?: number;
37
+ /**
38
+ * The runtimes the key covers. Defaults to what the other terms imply: `browser` when there are
39
+ * origins, `server` when there is a fingerprint, cpu count or memory.
40
+ */
41
+ runtimes?: LicenseRuntime[] | null;
22
42
  /** Licensed origins, `<protocol>://<host>` each (see `Origin`); a string is comma-separated. */
23
43
  domains?: string | string[];
24
44
  fingerprint?: string | null;
@@ -1 +0,0 @@
1
- const e=require("./KWQPie2u7AP69web.cjs");exports.initializeFunctions=e.R;