@simpleapps-com/augur-server 2026.11.5 → 2026.11.6
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/EXPORTS.md +26 -1
- package/README.md +21 -2
- package/dist/actions/action-rules.d.ts +99 -0
- package/dist/actions/action-rules.d.ts.map +1 -0
- package/dist/actions/agr-site.d.ts +7 -15
- package/dist/actions/agr-site.d.ts.map +1 -1
- package/dist/actions/commerce.d.ts.map +1 -1
- package/dist/actions/customers.d.ts +12 -15
- package/dist/actions/customers.d.ts.map +1 -1
- package/dist/actions/favorites.d.ts +9 -12
- package/dist/actions/favorites.d.ts.map +1 -1
- package/dist/actions/gregorovich.d.ts +7 -15
- package/dist/actions/gregorovich.d.ts.map +1 -1
- package/dist/actions/items.d.ts +8 -20
- package/dist/actions/items.d.ts.map +1 -1
- package/dist/actions/joomla.d.ts +8 -14
- package/dist/actions/joomla.d.ts.map +1 -1
- package/dist/actions/legacy.d.ts +10 -20
- package/dist/actions/legacy.d.ts.map +1 -1
- package/dist/actions/orders.d.ts +7 -14
- package/dist/actions/orders.d.ts.map +1 -1
- package/dist/actions/read-specs.d.ts +119 -0
- package/dist/actions/read-specs.d.ts.map +1 -0
- package/dist/actions/site.d.ts.map +1 -1
- package/dist/actions/vmi.d.ts +10 -16
- package/dist/actions/vmi.d.ts.map +1 -1
- package/dist/actions/wishlists.d.ts +11 -13
- package/dist/actions/wishlists.d.ts.map +1 -1
- package/dist/api.js +3 -2
- package/dist/api.js.map +1 -1
- package/dist/auth.js +3 -2
- package/dist/cache/redis-client.d.ts.map +1 -1
- package/dist/cache/redis-rules.d.ts +21 -0
- package/dist/cache/redis-rules.d.ts.map +1 -0
- package/dist/cache/spec-read.d.ts +39 -0
- package/dist/cache/spec-read.d.ts.map +1 -0
- package/dist/cache/with-cache.d.ts +2 -2
- package/dist/cache/with-cache.d.ts.map +1 -1
- package/dist/{chunk-FIM6LDMD.js → chunk-2RAKVFB5.js} +2 -2
- package/dist/{chunk-KSGH4DXD.js → chunk-4JPJQHT6.js} +2 -2
- package/dist/chunk-JIYVQWXK.js +10 -0
- package/dist/chunk-JIYVQWXK.js.map +1 -0
- package/dist/{chunk-U54IM6FL.js → chunk-SFXO74RC.js} +874 -719
- package/dist/chunk-SFXO74RC.js.map +1 -0
- package/dist/chunk-V76GZZF3.js +66 -0
- package/dist/chunk-V76GZZF3.js.map +1 -0
- package/dist/{chunk-6GPKXGPG.js → chunk-Z53NEFEQ.js} +8 -16
- package/dist/chunk-Z53NEFEQ.js.map +1 -0
- package/dist/hooks.js +3 -2
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/query-action.js +3 -2
- package/dist/read-rules.d.ts +45 -0
- package/dist/read-rules.d.ts.map +1 -0
- package/dist/server-site-registry.d.ts.map +1 -1
- package/dist/server-site.d.ts.map +1 -1
- package/dist/site.js +24 -14
- package/dist/site.js.map +1 -1
- package/dist/sitemap-rules.d.ts +154 -0
- package/dist/sitemap-rules.d.ts.map +1 -0
- package/dist/sitemap.d.ts +80 -0
- package/dist/sitemap.d.ts.map +1 -0
- package/dist/sitemap.js +242 -0
- package/dist/sitemap.js.map +1 -0
- package/dist/testing.js +4 -2
- package/dist/testing.js.map +1 -1
- package/dist/utils/read-all-pages.d.ts +17 -0
- package/dist/utils/read-all-pages.d.ts.map +1 -0
- package/llms.txt +44 -1
- package/package.json +8 -4
- package/dist/chunk-6GPKXGPG.js.map +0 -1
- package/dist/chunk-U54IM6FL.js.map +0 -1
- /package/dist/{chunk-FIM6LDMD.js.map → chunk-2RAKVFB5.js.map} +0 -0
- /package/dist/{chunk-KSGH4DXD.js.map → chunk-4JPJQHT6.js.map} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { EdgeCacheValue } from "@simpleapps-com/augur-core";
|
|
2
|
+
import type { Seconds } from "../duration";
|
|
3
|
+
/**
|
|
4
|
+
* Which config values a read uses: the short pair (redisTtl, edgeCache), the long pair, the short
|
|
5
|
+
* Redis TTL with the short edge (vmi availability), the short Redis TTL with a fixed 4-hour edge
|
|
6
|
+
* (items invMast and its doc), or the short Redis TTL and no edge value (joomla menu doc,
|
|
7
|
+
* gregorovich documents, whose routes take none).
|
|
8
|
+
*/
|
|
9
|
+
export type ReadTier = "short" | "long" | "shortRedis" | "itemEdge" | "shortNoEdge";
|
|
10
|
+
/**
|
|
11
|
+
* What a list read returns: one record, every row (paged until an empty page), the first `top`
|
|
12
|
+
* (an explicit limit), or what the caller's own limit and offset ask for.
|
|
13
|
+
*/
|
|
14
|
+
export type ReadPaging = "one" | "all" | "top" | "caller";
|
|
15
|
+
/** One action read. `keySuffix` is "" or a sub-key for a second shape of the same call. */
|
|
16
|
+
export interface ReadSpec {
|
|
17
|
+
sdkPath: string;
|
|
18
|
+
keySuffix: string;
|
|
19
|
+
tier: ReadTier;
|
|
20
|
+
paging: ReadPaging;
|
|
21
|
+
top: number;
|
|
22
|
+
}
|
|
23
|
+
/** A read spec from its parts. */
|
|
24
|
+
export declare function readSpec(sdkPath: string, keySuffix: string, tier: ReadTier, paging: ReadPaging, top: number): ReadSpec;
|
|
25
|
+
/**
|
|
26
|
+
* The method path the cache key is built from: the call's own, or a sub-key under it.
|
|
27
|
+
*
|
|
28
|
+
* @ensures exactly the model's KeyPath
|
|
29
|
+
*/
|
|
30
|
+
export declare function keyPath(spec: ReadSpec): string;
|
|
31
|
+
/**
|
|
32
|
+
* The Redis TTL a tier uses from the factory's config.
|
|
33
|
+
*
|
|
34
|
+
* @ensures exactly the model's TierRedis
|
|
35
|
+
*/
|
|
36
|
+
export declare function tierRedis(tier: ReadTier, redisTtl: Seconds, longRedisTtl: Seconds, shortRedisTtl: Seconds): Seconds;
|
|
37
|
+
/** Which edge value a tier sends: the config's short or long one, a fixed 4 hours, or none. */
|
|
38
|
+
export type EdgeChoice = "shortEdge" | "longEdge" | "fourHours" | "noEdge";
|
|
39
|
+
/**
|
|
40
|
+
* The edge value a tier sends (before augur-core strips it on a path the server never caches).
|
|
41
|
+
*
|
|
42
|
+
* @ensures exactly the model's TierEdge
|
|
43
|
+
*/
|
|
44
|
+
export declare function edgeChoice(tier: ReadTier): EdgeChoice;
|
|
45
|
+
/**
|
|
46
|
+
* The edge value a choice sends, from the factory's short and long values and the fixed four
|
|
47
|
+
* hours (`fourHours`, passed in: lsc keeps `EdgeCacheValue` opaque, so a literal can't be one);
|
|
48
|
+
* undefined for none.
|
|
49
|
+
*
|
|
50
|
+
* @ensures exactly the link's EdgeOf (the model's TierEdge through `edgeChoice`)
|
|
51
|
+
*/
|
|
52
|
+
export declare function edgeValueOf(choice: EdgeChoice, edge: EdgeCacheValue, longEdge: EdgeCacheValue, fourHours: EdgeCacheValue): EdgeCacheValue | undefined;
|
|
53
|
+
/** What a read call sends after its positional arguments: nothing, its params, or both + edge. */
|
|
54
|
+
export type SentShape = "argsOnly" | "withParams" | "withParamsAndEdge";
|
|
55
|
+
/**
|
|
56
|
+
* The call's shape: no params object sends the arguments alone (so no edge value), else the
|
|
57
|
+
* params, with the tier's edge value when it has one.
|
|
58
|
+
*
|
|
59
|
+
* @ensures exactly the model's SentShapeOf
|
|
60
|
+
*/
|
|
61
|
+
export declare function sentShape(hasParams: boolean, hasEdge: boolean): SentShape;
|
|
62
|
+
/**
|
|
63
|
+
* The limit a read sends: the page size on an every-row read, its `top` on a first-n read, else
|
|
64
|
+
* none of its own (one record, or the caller's own limit and offset).
|
|
65
|
+
*
|
|
66
|
+
* @ensures exactly the model's LimitSent
|
|
67
|
+
*/
|
|
68
|
+
export declare function limitSent(paging: ReadPaging, top: number, size: number): number | undefined;
|
|
69
|
+
export declare function categoryLookupRead(): ReadSpec;
|
|
70
|
+
export declare function categoryRead(): ReadSpec;
|
|
71
|
+
export declare function categoryItemsRead(): ReadSpec;
|
|
72
|
+
export declare function categoryAttributesRead(): ReadSpec;
|
|
73
|
+
export declare function invMastRead(): ReadSpec;
|
|
74
|
+
export declare function invMastDocRead(): ReadSpec;
|
|
75
|
+
export declare function stockRead(): ReadSpec;
|
|
76
|
+
/** The company summary of the stock call, cached apart from getStock's whole value (#98). */
|
|
77
|
+
export declare function stockSummaryRead(): ReadSpec;
|
|
78
|
+
export declare function faqsRead(): ReadSpec;
|
|
79
|
+
export declare function substitutesRead(): ReadSpec;
|
|
80
|
+
export declare function accessoriesRead(): ReadSpec;
|
|
81
|
+
/** The similar-items route takes no limit: one call. */
|
|
82
|
+
export declare function similarRead(): ReadSpec;
|
|
83
|
+
export declare function customerLookupRead(): ReadSpec;
|
|
84
|
+
export declare function customerDocRead(): ReadSpec;
|
|
85
|
+
export declare function customerOrdersRead(): ReadSpec;
|
|
86
|
+
export declare function customerOrderRead(): ReadSpec;
|
|
87
|
+
export declare function customerInvoicesRead(): ReadSpec;
|
|
88
|
+
export declare function customerInvoiceRead(): ReadSpec;
|
|
89
|
+
export declare function customerQuotesRead(): ReadSpec;
|
|
90
|
+
export declare function customerQuoteRead(): ReadSpec;
|
|
91
|
+
export declare function shipToRead(): ReadSpec;
|
|
92
|
+
export declare function warehousesRead(): ReadSpec;
|
|
93
|
+
export declare function availabilityRead(): ReadSpec;
|
|
94
|
+
export declare function distributorsRead(): ReadSpec;
|
|
95
|
+
export declare function productsRead(): ReadSpec;
|
|
96
|
+
export declare function inventoryProfilesRead(): ReadSpec;
|
|
97
|
+
export declare function restockHeadersRead(): ReadSpec;
|
|
98
|
+
export declare function sectionsRead(): ReadSpec;
|
|
99
|
+
export declare function wishlistsRead(): ReadSpec;
|
|
100
|
+
export declare function wishlistLinesRead(): ReadSpec;
|
|
101
|
+
export declare function favoritesRead(): ReadSpec;
|
|
102
|
+
export declare function contentRead(): ReadSpec;
|
|
103
|
+
export declare function contentListRead(): ReadSpec;
|
|
104
|
+
/** A menu's items under a parent: the route answers the whole subtree, read to the end. */
|
|
105
|
+
export declare function menuRead(): ReadSpec;
|
|
106
|
+
export declare function menuListRead(): ReadSpec;
|
|
107
|
+
export declare function menuDocRead(): ReadSpec;
|
|
108
|
+
export declare function userProfileRead(): ReadSpec;
|
|
109
|
+
export declare function webDescRead(): ReadSpec;
|
|
110
|
+
/** Its route takes no limit (only statusCd): one call. */
|
|
111
|
+
export declare function legacyAlsoBoughtRead(): ReadSpec;
|
|
112
|
+
export declare function tagsRead(): ReadSpec;
|
|
113
|
+
export declare function statesRead(): ReadSpec;
|
|
114
|
+
export declare function settingsRead(): ReadSpec;
|
|
115
|
+
export declare function robotsRead(): ReadSpec;
|
|
116
|
+
export declare function orderDocRead(): ReadSpec;
|
|
117
|
+
export declare function documentsRead(): ReadSpec;
|
|
118
|
+
export declare function cartAlsoBoughtRead(): ReadSpec;
|
|
119
|
+
//# sourceMappingURL=read-specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-specs.d.ts","sourceRoot":"","sources":["../../src/actions/read-specs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAW3C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,aAAa,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1D,2FAA2F;AAC3F,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,kCAAkC;AAClC,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,GACV,QAA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;IAC5B,aAAa,EAAE,oBAAoB,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,MAAM,EACnD,GAAG,EAAE,IAAI,EACT,MAAM,GAAE,iBAAsB,GAC7B,WAAW,CA4Pb"}
|
package/dist/actions/vmi.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { AugurAPI, VMITypes } from "@simpleapps-com/augur-api";
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
2
|
+
import type { ListResult } from "../sdk-call";
|
|
3
|
+
import { type SpecReadConfig } from "../cache/spec-read";
|
|
4
4
|
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
5
5
|
export type VmiApiClient = Pick<AugurAPI, "vmi">;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
redisTtl?: Seconds;
|
|
13
|
-
/** Redis TTL for short-lived data like availability. Default: 300 (5 min). */
|
|
14
|
-
shortRedisTtl?: Seconds;
|
|
15
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* Cache values (`shortRedisTtl` was availability's). VMI data is per customer and is a user path
|
|
8
|
+
* (augur-core `USER_PATHS`, atlas#102): the server never caches it, whatever these say; the
|
|
9
|
+
* browser keeps a short cache.
|
|
10
|
+
*/
|
|
11
|
+
export type VmiActionsConfig = SpecReadConfig;
|
|
16
12
|
export interface VmiActions {
|
|
17
13
|
getWarehouses: (params: VMITypes.WarehouseListParams) => Promise<ListResult>;
|
|
18
14
|
getWarehouseAvailability: (warehouseUid: number, params: VMITypes.WarehouseAvailabilityListParams) => Promise<ListResult>;
|
|
@@ -23,10 +19,8 @@ export interface VmiActions {
|
|
|
23
19
|
getSections: (params: VMITypes.SectionsListParams) => Promise<ListResult>;
|
|
24
20
|
}
|
|
25
21
|
/**
|
|
26
|
-
* Creates server-side VMI (Vendor Managed Inventory) actions
|
|
27
|
-
*
|
|
28
|
-
* All VMI read operations are cached. Warehouse availability uses a shorter TTL
|
|
29
|
-
* because inventory levels change more frequently than configuration data.
|
|
22
|
+
* Creates server-side VMI (Vendor Managed Inventory) actions. Each read is a spec
|
|
23
|
+
* (`read-specs.ts`) passing the caller's own paging; none is cached on the server.
|
|
30
24
|
*
|
|
31
25
|
* @example
|
|
32
26
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vmi.d.ts","sourceRoot":"","sources":["../../src/actions/vmi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"vmi.d.ts","sourceRoot":"","sources":["../../src/actions/vmi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAW3E,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE9C,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,mBAAmB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7E,wBAAwB,EAAE,CACxB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,QAAQ,CAAC,+BAA+B,KAC7C,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,eAAe,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAClF,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1E,oBAAoB,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACxF,iBAAiB,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACnF,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAC3E;AAED;;;;;;;;;;;;;;;;SAgBS;AACT,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,GAAE,gBAAqB,GAAG,UAAU,CAmD7F"}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import type { AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
-
import type
|
|
3
|
-
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
2
|
+
import { type AllRows, type SpecReadConfig } from "../cache/spec-read";
|
|
4
3
|
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
5
4
|
export type WishlistsApiClient = Pick<AugurAPI, "items">;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
12
|
-
redisTtl?: Seconds;
|
|
13
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* Cache values. Wishlists are a user path (augur-core `USER_PATHS`, atlas#102): the server never
|
|
7
|
+
* caches them, whatever these say; the browser keeps a short cache its own writes clear.
|
|
8
|
+
*/
|
|
9
|
+
export type WishlistActionsConfig = SpecReadConfig;
|
|
14
10
|
export interface WishlistActions {
|
|
15
|
-
|
|
11
|
+
/** Every wishlist of the user (paged to the end), and whether the page cap stopped the read. */
|
|
12
|
+
getWishlists: (userId: number) => Promise<AllRows>;
|
|
16
13
|
createWishlist: (userId: number, data: {
|
|
17
14
|
name: string;
|
|
18
15
|
description?: string;
|
|
19
16
|
}) => Promise<unknown>;
|
|
20
|
-
|
|
17
|
+
/** Every line of the wishlist (paged to the end). */
|
|
18
|
+
getWishlistDetail: (userId: number, wishlistId: number) => Promise<AllRows>;
|
|
21
19
|
deleteWishlist: (userId: number, wishlistId: number) => Promise<void>;
|
|
22
20
|
addWishlistItems: (userId: number, wishlistId: number, items: {
|
|
23
21
|
invMastUid: number;
|
|
24
22
|
}[]) => Promise<unknown>;
|
|
25
23
|
removeWishlistItem: (userId: number, wishlistId: number, lineId: number) => Promise<void>;
|
|
26
24
|
}
|
|
27
|
-
/** Creates server-side wishlist actions
|
|
25
|
+
/** Creates server-side wishlist actions: every read pages to the end and is never cached. */
|
|
28
26
|
export declare function createWishlistActions(api: WishlistsApiClient, config?: WishlistActionsConfig): WishlistActions;
|
|
29
27
|
//# sourceMappingURL=wishlists.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wishlists.d.ts","sourceRoot":"","sources":["../../src/actions/wishlists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
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B,EACvB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAsDjB"}
|
package/dist/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
queryAction,
|
|
3
3
|
queryActionRaw
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2RAKVFB5.js";
|
|
5
5
|
import {
|
|
6
6
|
answersFullOf,
|
|
7
7
|
apiMessageOf,
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
bodyOutcomeOf,
|
|
10
10
|
isCrossOrigin,
|
|
11
11
|
runsOf
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z53NEFEQ.js";
|
|
13
|
+
import "./chunk-V76GZZF3.js";
|
|
13
14
|
|
|
14
15
|
// src/api-handler.ts
|
|
15
16
|
function refusal(outcome) {
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api-handler.ts"],"sourcesContent":["/**\n * Generic API route handler for fetch-mode proxy.\n *\n * Exposes the existing queryAction as an HTTP POST endpoint so that\n * `createFetchQueryAction()` from augur-core can route calls through\n * fetch() instead of server actions. This is needed on platforms where\n * server actions cannot access request cookies (e.g., CF Workers via OpenNext).\n *\n * The handler validates same-origin requests via the Sec-Fetch-Site header\n * (set by browsers automatically and cannot be forged by scripts).\n */\n\nimport { queryAction, queryActionRaw } from \"./query-action\";\nimport {\n answersFullOf,\n apiMessageOf,\n apiStatusOf,\n bodyOutcomeOf,\n isCrossOrigin,\n runsOf,\n type ApiOutcome,\n} from \"./rules\";\n\n/** A refused request's response: the outcome's text and status. */\nfunction refusal(outcome: ApiOutcome): Response {\n return new Response(apiMessageOf(outcome), { status: apiStatusOf(outcome) });\n}\n\n/** Request body shape for the API handler; `raw: true` asks for the full response. */\ninterface AugurApiRequestBody {\n methodPath: string;\n args: unknown[];\n raw?: unknown;\n}\n\n/**\n * Creates a Next.js Route Handler that routes method calls through queryAction, or through\n * queryActionRaw when the body has `raw: true` (augur-core's `createFetchQueryActionRaw`).\n *\n * @example\n * ```ts\n * // app/api/augur/route.ts\n * import { createAugurApiHandler } from \"@simpleapps-com/augur-server/api\";\n *\n * const handler = createAugurApiHandler();\n * export const POST = handler;\n * ```\n */\nexport function createAugurApiHandler() {\n return async (req: Request): Promise<Response> => {\n // Same-origin validation: Sec-Fetch-Site is set by browsers and\n // cannot be forged by JavaScript. Reject cross-origin requests.\n if (isCrossOrigin(req.headers.get(\"sec-fetch-site\") ?? \"\")) return refusal(\"forbidden\");\n\n let body: AugurApiRequestBody;\n try {\n body = (await req.json()) as AugurApiRequestBody;\n } catch {\n return refusal(\"bad-json\");\n }\n\n const { methodPath, args, raw } = body;\n const outcome = bodyOutcomeOf(\n true,\n typeof methodPath === \"string\" && methodPath !== \"\",\n Array.isArray(args),\n raw === true,\n );\n if (!runsOf(outcome)) return refusal(outcome);\n\n try {\n const result = answersFullOf(outcome)\n ? await queryActionRaw(methodPath, ...args)\n : await queryAction(methodPath, ...args);\n return Response.json(result);\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Internal server error\";\n return new Response(message, { status: 500 });\n }\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/api-handler.ts"],"sourcesContent":["/**\n * Generic API route handler for fetch-mode proxy.\n *\n * Exposes the existing queryAction as an HTTP POST endpoint so that\n * `createFetchQueryAction()` from augur-core can route calls through\n * fetch() instead of server actions. This is needed on platforms where\n * server actions cannot access request cookies (e.g., CF Workers via OpenNext).\n *\n * The handler validates same-origin requests via the Sec-Fetch-Site header\n * (set by browsers automatically and cannot be forged by scripts).\n */\n\nimport { queryAction, queryActionRaw } from \"./query-action\";\nimport {\n answersFullOf,\n apiMessageOf,\n apiStatusOf,\n bodyOutcomeOf,\n isCrossOrigin,\n runsOf,\n type ApiOutcome,\n} from \"./rules\";\n\n/** A refused request's response: the outcome's text and status. */\nfunction refusal(outcome: ApiOutcome): Response {\n return new Response(apiMessageOf(outcome), { status: apiStatusOf(outcome) });\n}\n\n/** Request body shape for the API handler; `raw: true` asks for the full response. */\ninterface AugurApiRequestBody {\n methodPath: string;\n args: unknown[];\n raw?: unknown;\n}\n\n/**\n * Creates a Next.js Route Handler that routes method calls through queryAction, or through\n * queryActionRaw when the body has `raw: true` (augur-core's `createFetchQueryActionRaw`).\n *\n * @example\n * ```ts\n * // app/api/augur/route.ts\n * import { createAugurApiHandler } from \"@simpleapps-com/augur-server/api\";\n *\n * const handler = createAugurApiHandler();\n * export const POST = handler;\n * ```\n */\nexport function createAugurApiHandler() {\n return async (req: Request): Promise<Response> => {\n // Same-origin validation: Sec-Fetch-Site is set by browsers and\n // cannot be forged by JavaScript. Reject cross-origin requests.\n if (isCrossOrigin(req.headers.get(\"sec-fetch-site\") ?? \"\")) return refusal(\"forbidden\");\n\n let body: AugurApiRequestBody;\n try {\n body = (await req.json()) as AugurApiRequestBody;\n } catch {\n return refusal(\"bad-json\");\n }\n\n const { methodPath, args, raw } = body;\n const outcome = bodyOutcomeOf(\n true,\n typeof methodPath === \"string\" && methodPath !== \"\",\n Array.isArray(args),\n raw === true,\n );\n if (!runsOf(outcome)) return refusal(outcome);\n\n try {\n const result = answersFullOf(outcome)\n ? await queryActionRaw(methodPath, ...args)\n : await queryAction(methodPath, ...args);\n return Response.json(result);\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Internal server error\";\n return new Response(message, { status: 500 });\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAS,QAAQ,SAA+B;AAC9C,SAAO,IAAI,SAAS,aAAa,OAAO,GAAG,EAAE,QAAQ,YAAY,OAAO,EAAE,CAAC;AAC7E;AAsBO,SAAS,wBAAwB;AACtC,SAAO,OAAO,QAAoC;AAGhD,QAAI,cAAc,IAAI,QAAQ,IAAI,gBAAgB,KAAK,EAAE,EAAG,QAAO,QAAQ,WAAW;AAEtF,QAAI;AACJ,QAAI;AACF,aAAQ,MAAM,IAAI,KAAK;AAAA,IACzB,QAAQ;AACN,aAAO,QAAQ,UAAU;AAAA,IAC3B;AAEA,UAAM,EAAE,YAAY,MAAM,IAAI,IAAI;AAClC,UAAM,UAAU;AAAA,MACd;AAAA,MACA,OAAO,eAAe,YAAY,eAAe;AAAA,MACjD,MAAM,QAAQ,IAAI;AAAA,MAClB,QAAQ;AAAA,IACV;AACA,QAAI,CAAC,OAAO,OAAO,EAAG,QAAO,QAAQ,OAAO;AAE5C,QAAI;AACF,YAAM,SAAS,cAAc,OAAO,IAChC,MAAM,eAAe,YAAY,GAAG,IAAI,IACxC,MAAM,YAAY,YAAY,GAAG,IAAI;AACzC,aAAO,SAAS,KAAK,MAAM;AAAA,IAC7B,SAAS,OAAO;AACd,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,aAAO,IAAI,SAAS,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;","names":[]}
|
package/dist/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-client.d.ts","sourceRoot":"","sources":["../../src/cache/redis-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"redis-client.d.ts","sourceRoot":"","sources":["../../src/cache/redis-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,aAAa,CAAC;AAoHnD;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcpE;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAYxF;AAED,iDAAiD;AACjD,wBAAgB,eAAe,IAAI,QAAQ,GAAG,MAAM,CAEnD;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Millis } from "../duration";
|
|
2
|
+
/**
|
|
3
|
+
* The Redis URL: a container's `REDIS_SERVERS` first (as `redis://<servers>`), else the
|
|
4
|
+
* environment's own variable (dev, staging, else production); none when that one is unset.
|
|
5
|
+
*
|
|
6
|
+
* @ensures exactly the model's RedisUrl
|
|
7
|
+
*/
|
|
8
|
+
export declare function redisUrl(servers: string, isDev: boolean, isStaging: boolean, dev: string | undefined, staging: string | undefined, prod: string | undefined): string | undefined;
|
|
9
|
+
/** Debug logging is on in development and staging. */
|
|
10
|
+
export declare function debugEnabled(isDev: boolean, isStaging: boolean): boolean;
|
|
11
|
+
/** The circuit was open when it had an end time (0 is closed). */
|
|
12
|
+
export declare function wasOpen(openUntil: Millis): boolean;
|
|
13
|
+
/** The circuit just closed: it was open and the check found it closed (worth a log line). */
|
|
14
|
+
export declare function justClosed(wasOpenBefore: boolean, open: boolean): boolean;
|
|
15
|
+
/** The circuit's state as `getCircuitState` reports it. */
|
|
16
|
+
export declare function circuitLabel(open: boolean): string;
|
|
17
|
+
/** The client is ready for commands. */
|
|
18
|
+
export declare function isReady(status: string): boolean;
|
|
19
|
+
/** A cache read hit: Redis returned a stored text (`null` is a miss). */
|
|
20
|
+
export declare function isHit(cached: string | null): boolean;
|
|
21
|
+
//# sourceMappingURL=redis-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-rules.d.ts","sourceRoot":"","sources":["../../src/cache/redis-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,MAAM,GAAG,SAAS,CAUpB;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAIxE;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIlD;AAED,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAIzE;AAED,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAKlD;AAED,wCAAwC;AACxC,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI/C;AAED,yEAAyE;AACzE,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAIpD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type EdgeCacheValue, type ListResult } from "@simpleapps-com/augur-core";
|
|
2
|
+
import type { Seconds } from "../duration";
|
|
3
|
+
import { type ReadSpec } from "../actions/read-specs";
|
|
4
|
+
/**
|
|
5
|
+
* A factory's cache values. Each factory fills it from its own config (site.ts gives the short
|
|
6
|
+
* and long values; vmi adds `shortRedisTtl`).
|
|
7
|
+
*/
|
|
8
|
+
export interface SpecReadConfig {
|
|
9
|
+
cachePrefix?: string;
|
|
10
|
+
edgeCache?: EdgeCacheValue;
|
|
11
|
+
longEdgeCache?: EdgeCacheValue;
|
|
12
|
+
redisTtl?: Seconds;
|
|
13
|
+
longRedisTtl?: Seconds;
|
|
14
|
+
shortRedisTtl?: Seconds;
|
|
15
|
+
}
|
|
16
|
+
/** Every row of a list read, its count, and whether the page cap stopped it. */
|
|
17
|
+
export type AllRows<T = unknown> = ListResult<T> & {
|
|
18
|
+
capReached: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** The SDK client a factory holds: read by path, never by a hand-written chain. */
|
|
21
|
+
type SdkClient = object;
|
|
22
|
+
/**
|
|
23
|
+
* One action read (atlas#102): cached under the spec's key path with its tier's Redis TTL, which
|
|
24
|
+
* `withServerCache` turns to none on a path the server never caches (proved `readThroughTtl`).
|
|
25
|
+
* `shape` turns the SDK's answer into the action's value inside the cache.
|
|
26
|
+
*
|
|
27
|
+
* @param args The call's positional arguments, before its params object.
|
|
28
|
+
* @param params The call's params object, or undefined when the route takes none.
|
|
29
|
+
* @param keyArgs What the cache key hashes.
|
|
30
|
+
*/
|
|
31
|
+
export declare function specRead<T>(api: SdkClient, spec: ReadSpec, config: SpecReadConfig, args: unknown[], params: Record<string, unknown> | undefined, keyArgs: unknown[], shape: (answer: unknown) => T): Promise<T>;
|
|
32
|
+
/** `shape` for a list read: the SDK's envelope as a ListResult (every row for an "all" read). */
|
|
33
|
+
export declare function asList<T>(answer: unknown): ListResult<T>;
|
|
34
|
+
/** `shape` for an "all" read that keeps the cap flag. */
|
|
35
|
+
export declare function asAllRows<T>(answer: unknown): AllRows<T>;
|
|
36
|
+
/** `shape` for a one-record read: the envelope's `data`. */
|
|
37
|
+
export declare function asData<T>(answer: unknown): T;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=spec-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-read.d.ts","sourceRoot":"","sources":["../../src/cache/spec-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,uBAAuB,CAAC;AAK/B;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,gFAAgF;AAChF,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3E,mFAAmF;AACnF,KAAK,SAAS,GAAG,MAAM,CAAC;AAqExB;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,OAAO,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,OAAO,EAAE,OAAO,EAAE,EAClB,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,GAC5B,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,iGAAiG;AACjG,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAExD;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAExD;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,CAE5C"}
|
|
@@ -8,10 +8,10 @@ import type { Seconds } from "../duration";
|
|
|
8
8
|
* @param fn The async function to cache.
|
|
9
9
|
* @param keyArgs Values to hash for the cache key.
|
|
10
10
|
*/
|
|
11
|
-
export declare
|
|
11
|
+
export declare const withServerCache: <T>(prefix: string, redisTtl: Seconds | undefined, methodPath: string, fn: () => Promise<T>, ...keyArgs: unknown[]) => Promise<T>;
|
|
12
12
|
/**
|
|
13
13
|
* Caches a raw SDK result (the envelope as returned), in its own key space: the same
|
|
14
14
|
* parameters as {@link withServerCache}.
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
16
|
+
export declare const withRawSdkCache: <T>(prefix: string, redisTtl: Seconds | undefined, methodPath: string, fn: () => Promise<T>, ...keyArgs: unknown[]) => Promise<T>;
|
|
17
17
|
//# sourceMappingURL=with-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-cache.d.ts","sourceRoot":"","sources":["../../src/cache/with-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-cache.d.ts","sourceRoot":"","sources":["../../src/cache/with-cache.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA6E3C;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GApBG,CAAC,UACpB,MAAM,YACJ,OAAO,GAAG,SAAS,cACjB,MAAM,MACd,MAAM,OAAO,CAAC,CAAC,CAAC,cACR,OAAO,EAAE,KACpB,OAAO,CAAC,CAAC,CAc2C,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,eAAe,GA1BG,CAAC,UACpB,MAAM,YACJ,OAAO,GAAG,SAAS,cACjB,MAAM,MACd,MAAM,OAAO,CAAC,CAAC,CAAC,cACR,OAAO,EAAE,KACpB,OAAO,CAAC,CAAC,CAoB8C,CAAC"}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
scopedPrefix,
|
|
15
15
|
sessionCookieName,
|
|
16
16
|
usesCache
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z53NEFEQ.js";
|
|
18
18
|
|
|
19
19
|
// src/query-action.ts
|
|
20
20
|
import {
|
|
@@ -185,4 +185,4 @@ export {
|
|
|
185
185
|
queryActionRawWith,
|
|
186
186
|
resetSessionImports
|
|
187
187
|
};
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
188
|
+
//# sourceMappingURL=chunk-2RAKVFB5.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getCrossSite,
|
|
3
3
|
signInTarget,
|
|
4
4
|
verifiedFlag
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Z53NEFEQ.js";
|
|
6
6
|
|
|
7
7
|
// src/auth.ts
|
|
8
8
|
import Credentials from "next-auth/providers/credentials";
|
|
@@ -171,4 +171,4 @@ function createAuthConfig(options) {
|
|
|
171
171
|
export {
|
|
172
172
|
createAuthConfig
|
|
173
173
|
};
|
|
174
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-4JPJQHT6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../foundation/src/decimal.ts"],"sourcesContent":["//@ backend dafny\n\n/* Verified with LemmaScript → Dafny (`pnpm proofs`; hand lemmas in decimal.dfy; model:\n models/Platform.dfy Decimal; link: models/links/foundation-decimal.dfy): how every app\n writes an id as text. Used by services/agr-int-mcp (customer grant ids `<site>|<usersUid>`) and\n packages/joomla-auth (staff grant ids `staff-<Joomla user id>`), so both are one-to-one\n by the same proof. */\n\n/**\n * The decimal digits of `n`, exactly what `String(n)` gives for a non-negative integer\n * (tests pin the two together). Recursive so specs can use it. Injective: different numbers\n * are written differently (lemma DecimalInjective, decimal.dfy; Platform.DecimalInjective).\n *\n * @ensures |result| ≥ 1 ∧ ∀ k < |result|. result[k] ∈ '0'..'9'\n */\nexport function decimal(n: number): string {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ decreases n\n //@ ensures \\result.length > 0\n //@ ensures forall(k: nat, k < \\result.length ==> (\\result.charCodeAt(k) >= 48 && \\result.charCodeAt(k) <= 57))\n const last = \"0123456789\".slice(n % 10, (n % 10) + 1);\n return n < 10 ? last : decimal(Math.floor(n / 10)) + last;\n}\n\n/**\n * Any integer as `String(n)` writes it: a minus for a negative, then `decimal`'s digits\n * (tests pin it to `String` for safe integers). An id written this way can't change a path.\n *\n * @ensures result is digits, after a \"-\" exactly when n < 0 — never empty, so an id written\n * this way can't change a path; exactly the model's Platform.IntText in the link (a contract\n * naming `decimal` couldn't be resolved by an importer, models/LSC-GAPS.md, so importers that\n * need the exact text take the link's equality as a premise)\n */\nexport function intText(n: number): string {\n //@ verify\n //@ type n int\n //@ ensures \\result.length > 0\n //@ ensures n >= 0 ==> forall(k: nat, k < \\result.length ==> (\\result.charCodeAt(k) >= 48 && \\result.charCodeAt(k) <= 57))\n //@ ensures n < 0 ==> (\\result.length > 1 && \\result.charCodeAt(0) === 45 && forall(k: nat, (1 <= k && k < \\result.length) ==> (\\result.charCodeAt(k) >= 48 && \\result.charCodeAt(k) <= 57)))\n return n < 0 ? \"-\" + decimal(-n) : decimal(n);\n}\n"],"mappings":";AAeO,SAAS,QAAQ,GAAmB;AAOzC,QAAM,OAAO,aAAa,MAAM,IAAI,IAAK,IAAI,KAAM,CAAC;AACpD,SAAO,IAAI,KAAK,OAAO,QAAQ,KAAK,MAAM,IAAI,EAAE,CAAC,IAAI;AACvD;","names":[]}
|