@wix/himalaya-cli 0.903.0 → 0.905.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.
Files changed (27) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/events/src/index.d.ts +39 -21
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +1 -9
  3. package/dist/cli.mjs +74 -20
  4. package/guides/sdk-reference.json +5 -5
  5. package/package.json +2 -2
  6. package/templates/beauty-salon/dev/index.ts +6 -3
  7. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +45 -3
  8. package/templates/branded-lite/dev/index.ts +8 -4
  9. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +45 -3
  10. package/templates/community-club/dev/index.ts +4 -2
  11. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +45 -3
  12. package/templates/events-meetups/dev/index.ts +4 -2
  13. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +45 -3
  14. package/templates/gym-fitness/dev/index.ts +8 -4
  15. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +45 -3
  16. package/templates/nonprofit-cause/dev/index.ts +4 -2
  17. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +45 -3
  18. package/templates/podcast-creator/dev/index.ts +4 -2
  19. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +45 -3
  20. package/templates/portfolio-creative/dev/index.ts +6 -3
  21. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +45 -3
  22. package/templates/restaurant/dev/index.ts +4 -2
  23. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +45 -3
  24. package/templates/retail-store/dev/index.ts +4 -2
  25. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +45 -3
  26. package/templates/yoga-studio/dev/index.ts +6 -3
  27. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +45 -3
@@ -35,11 +35,14 @@ export interface WixEventLocation {
35
35
  export interface WixEvent {
36
36
  id: string;
37
37
  title?: string;
38
- /** Normally one of `WixEventStatus`, but deliberately NOT narrowed to it: `decodeEvent`
39
- * fills this from the server's `status` and passes a value it does not recognise straight
40
- * through, because dropping or rewriting one would lose a real event. A union here would
41
- * be a claim this SDK cannot enforce. Compare against `WixEventStatus` when you need the
42
- * stored set; the narrowing that IS enforced is on the `statuses` filter below. */
38
+ /** Normally one of `WixEventStatus` — `UPCOMING` (published and scheduled to start),
39
+ * `STARTED`, `ENDED`, `CANCELED`, `DRAFT`. Events v1 called the first of those `SCHEDULED`,
40
+ * and this SDK reads v3, so a row here never carries `SCHEDULED`.
41
+ *
42
+ * Deliberately NOT narrowed to that union: `decodeEvent` fills this from the server's
43
+ * `status` and passes a value it does not recognise straight through, because dropping or
44
+ * rewriting one would lose a real event. A union here would be a claim this SDK cannot
45
+ * enforce. Compare against `WixEventStatus` when you need the set it knows. */
43
46
  eventStatus?: string;
44
47
  /** EventType: RSVP | TICKETS | EXTERNAL | NO_REGISTRATION */
45
48
  eventType?: string;
@@ -59,9 +62,15 @@ export interface WixGetEventResponse {
59
62
  }
60
63
  export interface WixDeleteEventResponse {
61
64
  }
62
- /** The stored event statuses — what this SDK knows the server stores, and so the only values
63
- * the `statuses` filter can match. The one source for both the runtime guard and the type
64
- * below, so a status added here cannot be missed by either.
65
+ /** The event statuses this SDK knows the server stores — the Events **v3** set, because that
66
+ * is the API `queryEvents` and `getEvent` call. `UPCOMING` is a published event that has not
67
+ * started; v1 called that one `SCHEDULED`, and v3 does not use that spelling at all, so a
68
+ * filter copied from v1 docs matches nothing. The one source for `WixEventStatus` below, so
69
+ * the two cannot drift.
70
+ *
71
+ * Known, not exhaustive. The server owns this list and versions it — it has already been
72
+ * renamed once, and v3 declares an `UNKNOWN_EVENT_STATUS` of its own — so nothing here
73
+ * refuses a value that is absent from it. Use it to recognise a status, never to reject one.
65
74
  *
66
75
  * Exported because `WixEventStatus` is declared in terms of it: the generated SDK reference
67
76
  * ships each exported declaration verbatim, and a reader copying a type that names a symbol
@@ -69,12 +78,11 @@ export interface WixDeleteEventResponse {
69
78
  *
70
79
  * Frozen because `as const` is erased: it makes the TYPE readonly and leaves an ordinary
71
80
  * mutable array behind. Unexported that was academic; exported it is not — module bindings
72
- * share one array object, so a `push` from any untyped caller would edit the very set
73
- * `queryEvents` validates against, for every caller in that realm. The freeze makes the
74
- * runtime keep the promise the type already makes. */
75
- export declare const EVENT_STATUSES: readonly ["SCHEDULED", "STARTED", "ENDED", "CANCELED", "DRAFT"];
76
- /** One of the stored event statuses. `WixQueryEventsOptions.statuses` takes these, so a value
77
- * outside the set is refused while the call is being written rather than when it is made. */
81
+ * share one array object, so a `push` from any untyped caller would edit the set every
82
+ * caller in that realm reads. The freeze makes the runtime keep the promise the type makes. */
83
+ export declare const EVENT_STATUSES: readonly ["UPCOMING", "STARTED", "ENDED", "CANCELED", "DRAFT"];
84
+ /** One of the event statuses this SDK knows about. `WixQueryEventsOptions.statuses` accepts
85
+ * these and suggests them as you type, but does not require them — see that field. */
78
86
  export type WixEventStatus = (typeof EVENT_STATUSES)[number];
79
87
  export interface WixQueryEventsOptions {
80
88
  /** Server-side WQL filter/sort for Events v3. Unlike the legacy convenience
@@ -94,13 +102,23 @@ export interface WixQueryEventsOptions {
94
102
  limit?: number;
95
103
  /** Page offset. */
96
104
  offset?: number;
97
- /** Status filter (e.g. `["SCHEDULED"]`). Every entry must be a `WixEventStatus`; anything
98
- * else is refused rather than quietly matching nothing — by the compiler for a typed caller,
99
- * and at runtime for one that is not. Omitted → all statuses returned.
100
- * There is no stored "upcoming" status; select future events by their start date.
101
- * For a value the server accepts that `WixEventStatus` does not name, use `query.filter`,
102
- * which is passed through to the server unchanged. */
103
- statuses?: WixEventStatus[];
105
+ /** Status filter (e.g. `["UPCOMING"]`), matched exactly against each row's `eventStatus`.
106
+ * Omitted → all statuses returned; a value no row carries selects nothing.
107
+ *
108
+ * This route is Events **v3**, whose statuses are `UPCOMING` (published and scheduled to
109
+ * start), `STARTED`, `ENDED`, `CANCELED` and `DRAFT`. Events v1 named the first of those
110
+ * `SCHEDULED`, so a filter copied from v1 docs matches no row a v3 site returns — reach
111
+ * for `UPCOMING` instead.
112
+ *
113
+ * The type suggests `EVENT_STATUSES` without closing on them: the server owns that list and
114
+ * versions it, so a value it adds later must reach the match rather than be refused on the
115
+ * strength of a copy that has fallen behind. A status this SDK does not know is filtered on
116
+ * like any other and selects the rows that carry it — or none, which is the honest answer
117
+ * and one a caller can read.
118
+ *
119
+ * Applied to the fetched page, after paging. To filter server-side instead, use
120
+ * `query.filter`, which is passed through unchanged. */
121
+ statuses?: Array<WixEventStatus | (string & {})>;
104
122
  /** Sort property (the Owner list orders by "start"). */
105
123
  order?: string;
106
124
  /** Free-text title search. */
@@ -242,7 +242,7 @@ function wixCall(method, path, body) {
242
242
  return globalThis.himalaya.wixApi.call(method, path, body);
243
243
  }
244
244
  var BASE = "https://manage.wix.com/_api/wix-one-events-server/events-in-clubs";
245
- var EVENT_STATUSES = Object.freeze(["SCHEDULED", "STARTED", "ENDED", "CANCELED", "DRAFT"]);
245
+ var EVENT_STATUSES = Object.freeze(["UPCOMING", "STARTED", "ENDED", "CANCELED", "DRAFT"]);
246
246
  function decodeEvent(raw) {
247
247
  if (raw == null) return raw;
248
248
  const r = raw;
@@ -265,14 +265,6 @@ function eventStartMs(e) {
265
265
  return Number.isNaN(ms) ? Number.POSITIVE_INFINITY : ms;
266
266
  }
267
267
  async function queryEvents(opts = {}) {
268
- const unknown = (opts.statuses ?? []).filter((s) => !EVENT_STATUSES.includes(s));
269
- if (unknown.length > 0) {
270
- throw new Error(
271
- // Quoted, so that a value whose defect is invisible unquoted — a stray space, an empty
272
- // string — reads as the defect it is rather than as a name the reader has to doubt.
273
- `queryEvents: unknown status ${unknown.map((s) => JSON.stringify(s)).join(", ")} \u2014 statuses must be one of ${EVENT_STATUSES.join(", ")}`
274
- );
275
- }
276
268
  const limit = opts.limit ?? opts.query?.paging?.limit ?? 50;
277
269
  const offset = opts.offset ?? opts.query?.paging?.offset ?? 0;
278
270
  const res = await wixCall("POST", "/events/v3/events/query", { query: { ...opts.query, paging: { limit, offset } } });