@sasjs/api 0.28.0 → 0.30.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/build/browser.js +36 -3
- package/build/cjs/appstream/service.js +48 -5
- package/build/cjs/appstream/web.js +7 -3
- package/build/esm/appstream/service.d.ts.map +1 -1
- package/build/esm/appstream/service.js +48 -5
- package/build/esm/appstream/web.d.ts.map +1 -1
- package/build/esm/appstream/web.js +7 -3
- package/package.json +3 -3
package/build/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @sasjs/api 0.
|
|
1
|
+
/* @sasjs/api 0.30.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
|
|
2
2
|
"use strict";
|
|
3
3
|
var SASjsApi = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -3231,7 +3231,28 @@ var SASjsApi = (() => {
|
|
|
3231
3231
|
if (value === void 0) return defaultAppName(appLoc);
|
|
3232
3232
|
if (typeof value !== "string" || value.trim() === "")
|
|
3233
3233
|
throw new ApiError(400, '"name" must be a non-empty string');
|
|
3234
|
-
return value.trim();
|
|
3234
|
+
return urlSafeName(value.trim());
|
|
3235
|
+
};
|
|
3236
|
+
var NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._~-]*$/;
|
|
3237
|
+
var NAME_MAX_LENGTH = 64;
|
|
3238
|
+
var RESERVED_NAMES = ["apps.json", "index.html"];
|
|
3239
|
+
var urlSafeName = (name) => {
|
|
3240
|
+
if (name.length > NAME_MAX_LENGTH)
|
|
3241
|
+
throw new ApiError(
|
|
3242
|
+
400,
|
|
3243
|
+
`"name" must be at most ${NAME_MAX_LENGTH} characters, and "${name}" is ${name.length}.`
|
|
3244
|
+
);
|
|
3245
|
+
if (!NAME_PATTERN.test(name))
|
|
3246
|
+
throw new ApiError(
|
|
3247
|
+
400,
|
|
3248
|
+
`"name" must be usable as a URL segment - letters, digits, dot, dash, underscore or tilde, starting with a letter or digit - so "/app/${name}" can be opened. "${name}" is not, because it carries a character that has to be percent-encoded, or a space.`
|
|
3249
|
+
);
|
|
3250
|
+
if (RESERVED_NAMES.includes(name.toLowerCase()))
|
|
3251
|
+
throw new ApiError(
|
|
3252
|
+
400,
|
|
3253
|
+
`"name" cannot be "${name}": the App Stream answers /app/${name} itself, so an app with that name could never be opened by name.`
|
|
3254
|
+
);
|
|
3255
|
+
return name;
|
|
3235
3256
|
};
|
|
3236
3257
|
var logoOf = (value) => {
|
|
3237
3258
|
if (value === void 0) return void 0;
|
|
@@ -3291,11 +3312,23 @@ var SASjsApi = (() => {
|
|
|
3291
3312
|
);
|
|
3292
3313
|
const logo = checked.logo;
|
|
3293
3314
|
const frameAncestors = checked.frameAncestors;
|
|
3315
|
+
const statedName = checked.name;
|
|
3316
|
+
const name = statedName !== void 0 ? nameOf(statedName, appLoc) : existing?.name ?? nameOf(void 0, appLoc);
|
|
3317
|
+
if (statedName !== void 0) {
|
|
3318
|
+
const clash = entries.find(
|
|
3319
|
+
(candidate) => !sameAppLoc(candidate.appLoc, appLoc) && candidate.name.toLowerCase() === name.toLowerCase()
|
|
3320
|
+
);
|
|
3321
|
+
if (clash)
|
|
3322
|
+
throw new ApiError(
|
|
3323
|
+
409,
|
|
3324
|
+
`The name "${name}" is already the address of the app published at ${clash.appLoc}. A stated name is how the app opens (/app/${name}), and two apps holding one name would answer an ambiguous lookup with nothing, so publish this one under a different name.`
|
|
3325
|
+
);
|
|
3326
|
+
}
|
|
3294
3327
|
const entry = {
|
|
3295
3328
|
id: existing ? existing.id : newAppId(),
|
|
3296
3329
|
// the label is the one field a redeploy inherits: everything else is
|
|
3297
3330
|
// what this publish states
|
|
3298
|
-
name
|
|
3331
|
+
name,
|
|
3299
3332
|
appLoc,
|
|
3300
3333
|
streamWebFolder,
|
|
3301
3334
|
...logo === void 0 ? {} : { logo },
|
|
@@ -7,9 +7,11 @@ exports.MemoryAppStreamStore = exports.createAppStreamService = exports.checkPub
|
|
|
7
7
|
* An app is one deployed folder (`appLoc`), the web assets inside it
|
|
8
8
|
* (`appLoc/services/<streamWebFolder>`) and a UUID assigned when it is first
|
|
9
9
|
* published. The id is the key the routes, the listing and the permission rules
|
|
10
|
-
* point at
|
|
11
|
-
*
|
|
12
|
-
* is
|
|
10
|
+
* point at, and it is what a redeploy keeps. The name is a label a person reads
|
|
11
|
+
* AND - when exactly one app holds it - an address: `/app/<name>` opens the app,
|
|
12
|
+
* so a name the caller states is validated as a URL segment and has to be free.
|
|
13
|
+
* A label derived from the folder carries no such rule, because it was not
|
|
14
|
+
* chosen: two folders may share a leaf name and both stay openable by id.
|
|
13
15
|
*
|
|
14
16
|
* The service is the decisions, and a host supplies the storage. That split is
|
|
15
17
|
* the point of this package: sasjs/server keeps the index in a JSON file beside
|
|
@@ -140,7 +142,34 @@ const nameOf = (value, appLoc) => {
|
|
|
140
142
|
return (0, exports.defaultAppName)(appLoc);
|
|
141
143
|
if (typeof value !== 'string' || value.trim() === '')
|
|
142
144
|
throw new types_js_1.ApiError(400, '"name" must be a non-empty string');
|
|
143
|
-
return value.trim();
|
|
145
|
+
return urlSafeName(value.trim());
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* A stated name is a URL segment, so it has to be spellable in one.
|
|
149
|
+
*
|
|
150
|
+
* `/app/<name>` resolves an app by its name when exactly one holds it, which
|
|
151
|
+
* makes the name an address and not only a label. A name carrying a space, a
|
|
152
|
+
* `#`, a `?` or a `/` is either unopenable or forced through percent-encoding -
|
|
153
|
+
* `/app/Macro%20Dash/` - and a name that collides with the surface's own paths
|
|
154
|
+
* (`apps.json`, the landing page's `index.html`) can never be opened by name at
|
|
155
|
+
* all, because those are answered before any app is looked up.
|
|
156
|
+
*
|
|
157
|
+
* Only a STATED name is held to this. A label derived from the folder stays as
|
|
158
|
+
* the folder spelled it, because a deployment that never chose a name did not
|
|
159
|
+
* choose an address either, and two folders sharing a leaf name are a fact of
|
|
160
|
+
* the drive rather than a naming decision.
|
|
161
|
+
*/
|
|
162
|
+
const NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._~-]*$/;
|
|
163
|
+
const NAME_MAX_LENGTH = 64;
|
|
164
|
+
const RESERVED_NAMES = ['apps.json', 'index.html'];
|
|
165
|
+
const urlSafeName = (name) => {
|
|
166
|
+
if (name.length > NAME_MAX_LENGTH)
|
|
167
|
+
throw new types_js_1.ApiError(400, `"name" must be at most ${NAME_MAX_LENGTH} characters, and "${name}" is ${name.length}.`);
|
|
168
|
+
if (!NAME_PATTERN.test(name))
|
|
169
|
+
throw new types_js_1.ApiError(400, `"name" must be usable as a URL segment - letters, digits, dot, dash, underscore or tilde, starting with a letter or digit - so "/app/${name}" can be opened. "${name}" is not, because it carries a character that has to be percent-encoded, or a space.`);
|
|
170
|
+
if (RESERVED_NAMES.includes(name.toLowerCase()))
|
|
171
|
+
throw new types_js_1.ApiError(400, `"name" cannot be "${name}": the App Stream answers /app/${name} itself, so an app with that name could never be opened by name.`);
|
|
172
|
+
return name;
|
|
144
173
|
};
|
|
145
174
|
const logoOf = (value) => {
|
|
146
175
|
if (value === undefined)
|
|
@@ -211,11 +240,25 @@ const createAppStreamService = (store) => {
|
|
|
211
240
|
const existing = entries.find((entry) => sameAppLoc(entry.appLoc, appLoc));
|
|
212
241
|
const logo = checked.logo;
|
|
213
242
|
const frameAncestors = checked.frameAncestors;
|
|
243
|
+
// A name this publish STATES is an address, so it is validated as a URL
|
|
244
|
+
// segment and has to be free. A name it inherits from the last publish,
|
|
245
|
+
// or one derived from the folder, is a label only: it was not chosen
|
|
246
|
+
// here, it may predate this rule, and two folders may share a leaf name.
|
|
247
|
+
const statedName = checked.name;
|
|
248
|
+
const name = statedName !== undefined
|
|
249
|
+
? nameOf(statedName, appLoc)
|
|
250
|
+
: (existing?.name ?? nameOf(undefined, appLoc));
|
|
251
|
+
if (statedName !== undefined) {
|
|
252
|
+
const clash = entries.find((candidate) => !sameAppLoc(candidate.appLoc, appLoc) &&
|
|
253
|
+
candidate.name.toLowerCase() === name.toLowerCase());
|
|
254
|
+
if (clash)
|
|
255
|
+
throw new types_js_1.ApiError(409, `The name "${name}" is already the address of the app published at ${clash.appLoc}. A stated name is how the app opens (/app/${name}), and two apps holding one name would answer an ambiguous lookup with nothing, so publish this one under a different name.`);
|
|
256
|
+
}
|
|
214
257
|
const entry = {
|
|
215
258
|
id: existing ? existing.id : (0, identity_js_1.newAppId)(),
|
|
216
259
|
// the label is the one field a redeploy inherits: everything else is
|
|
217
260
|
// what this publish states
|
|
218
|
-
name
|
|
261
|
+
name,
|
|
219
262
|
appLoc,
|
|
220
263
|
streamWebFolder,
|
|
221
264
|
...(logo === undefined ? {} : { logo }),
|
|
@@ -156,9 +156,13 @@ const createAppStreamWebService = (appStream, drive, options = {}) => {
|
|
|
156
156
|
].join(''));
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
159
|
-
* The app a URL segment names: its id, or
|
|
160
|
-
*
|
|
161
|
-
*
|
|
159
|
+
* The app a URL segment names: its id, or its label when one app alone holds
|
|
160
|
+
* that label. The label is a real address, not a convenience - `/app/<name>`
|
|
161
|
+
* is the readable form of an app's URL - and the publish side keeps it usable
|
|
162
|
+
* by validating a stated name as a URL segment and refusing one another app
|
|
163
|
+
* holds. An ambiguous label still resolves to nothing, because a label derived
|
|
164
|
+
* from a folder has no uniqueness rule of its own, and guessing which of two
|
|
165
|
+
* same-named apps a URL meant is worse than a 404.
|
|
162
166
|
*/
|
|
163
167
|
const resolve = async (segment, allow) => {
|
|
164
168
|
const entries = await appStream.list(allow);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/appstream/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/appstream/service.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAA;IACV,uEAAuE;IACvE,IAAI,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C,cAAc,CAAC,CAAA;CAC/C;AAED,0EAA0E;AAC1E,eAAO,MAAM,UAAU,GACrB,OAAO,cAAc,KACpB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAIxC,CAAA;AAaF,gEAAgE;AAChE,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAI/C,CAAA;AA0BD,wEAAwE;AACxE,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,iBAAiB,EACjB,gBAAgB,CACjB;IACC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,OAAO,EACb,iBAAiB,MAAM,KACtB,OAsBF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,iBAAiB,EAC1B,OAAO,OAAO,EACd,UAAS;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAO,KAC7C,cAsCF,CAAA;AA8ED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,cAAc,KACpB,gBAwIF,CAAA;AAED,yFAAyF;AACzF,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,OAAO,CAAkB;gBAErB,OAAO,GAAE,cAAc,EAAO;IAIpC,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIjC,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD"}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* An app is one deployed folder (`appLoc`), the web assets inside it
|
|
5
5
|
* (`appLoc/services/<streamWebFolder>`) and a UUID assigned when it is first
|
|
6
6
|
* published. The id is the key the routes, the listing and the permission rules
|
|
7
|
-
* point at
|
|
8
|
-
*
|
|
9
|
-
* is
|
|
7
|
+
* point at, and it is what a redeploy keeps. The name is a label a person reads
|
|
8
|
+
* AND - when exactly one app holds it - an address: `/app/<name>` opens the app,
|
|
9
|
+
* so a name the caller states is validated as a URL segment and has to be free.
|
|
10
|
+
* A label derived from the folder carries no such rule, because it was not
|
|
11
|
+
* chosen: two folders may share a leaf name and both stay openable by id.
|
|
10
12
|
*
|
|
11
13
|
* The service is the decisions, and a host supplies the storage. That split is
|
|
12
14
|
* the point of this package: sasjs/server keeps the index in a JSON file beside
|
|
@@ -133,7 +135,34 @@ const nameOf = (value, appLoc) => {
|
|
|
133
135
|
return defaultAppName(appLoc);
|
|
134
136
|
if (typeof value !== 'string' || value.trim() === '')
|
|
135
137
|
throw new ApiError(400, '"name" must be a non-empty string');
|
|
136
|
-
return value.trim();
|
|
138
|
+
return urlSafeName(value.trim());
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* A stated name is a URL segment, so it has to be spellable in one.
|
|
142
|
+
*
|
|
143
|
+
* `/app/<name>` resolves an app by its name when exactly one holds it, which
|
|
144
|
+
* makes the name an address and not only a label. A name carrying a space, a
|
|
145
|
+
* `#`, a `?` or a `/` is either unopenable or forced through percent-encoding -
|
|
146
|
+
* `/app/Macro%20Dash/` - and a name that collides with the surface's own paths
|
|
147
|
+
* (`apps.json`, the landing page's `index.html`) can never be opened by name at
|
|
148
|
+
* all, because those are answered before any app is looked up.
|
|
149
|
+
*
|
|
150
|
+
* Only a STATED name is held to this. A label derived from the folder stays as
|
|
151
|
+
* the folder spelled it, because a deployment that never chose a name did not
|
|
152
|
+
* choose an address either, and two folders sharing a leaf name are a fact of
|
|
153
|
+
* the drive rather than a naming decision.
|
|
154
|
+
*/
|
|
155
|
+
const NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._~-]*$/;
|
|
156
|
+
const NAME_MAX_LENGTH = 64;
|
|
157
|
+
const RESERVED_NAMES = ['apps.json', 'index.html'];
|
|
158
|
+
const urlSafeName = (name) => {
|
|
159
|
+
if (name.length > NAME_MAX_LENGTH)
|
|
160
|
+
throw new ApiError(400, `"name" must be at most ${NAME_MAX_LENGTH} characters, and "${name}" is ${name.length}.`);
|
|
161
|
+
if (!NAME_PATTERN.test(name))
|
|
162
|
+
throw new ApiError(400, `"name" must be usable as a URL segment - letters, digits, dot, dash, underscore or tilde, starting with a letter or digit - so "/app/${name}" can be opened. "${name}" is not, because it carries a character that has to be percent-encoded, or a space.`);
|
|
163
|
+
if (RESERVED_NAMES.includes(name.toLowerCase()))
|
|
164
|
+
throw new ApiError(400, `"name" cannot be "${name}": the App Stream answers /app/${name} itself, so an app with that name could never be opened by name.`);
|
|
165
|
+
return name;
|
|
137
166
|
};
|
|
138
167
|
const logoOf = (value) => {
|
|
139
168
|
if (value === undefined)
|
|
@@ -204,11 +233,25 @@ export const createAppStreamService = (store) => {
|
|
|
204
233
|
const existing = entries.find((entry) => sameAppLoc(entry.appLoc, appLoc));
|
|
205
234
|
const logo = checked.logo;
|
|
206
235
|
const frameAncestors = checked.frameAncestors;
|
|
236
|
+
// A name this publish STATES is an address, so it is validated as a URL
|
|
237
|
+
// segment and has to be free. A name it inherits from the last publish,
|
|
238
|
+
// or one derived from the folder, is a label only: it was not chosen
|
|
239
|
+
// here, it may predate this rule, and two folders may share a leaf name.
|
|
240
|
+
const statedName = checked.name;
|
|
241
|
+
const name = statedName !== undefined
|
|
242
|
+
? nameOf(statedName, appLoc)
|
|
243
|
+
: (existing?.name ?? nameOf(undefined, appLoc));
|
|
244
|
+
if (statedName !== undefined) {
|
|
245
|
+
const clash = entries.find((candidate) => !sameAppLoc(candidate.appLoc, appLoc) &&
|
|
246
|
+
candidate.name.toLowerCase() === name.toLowerCase());
|
|
247
|
+
if (clash)
|
|
248
|
+
throw new ApiError(409, `The name "${name}" is already the address of the app published at ${clash.appLoc}. A stated name is how the app opens (/app/${name}), and two apps holding one name would answer an ambiguous lookup with nothing, so publish this one under a different name.`);
|
|
249
|
+
}
|
|
207
250
|
const entry = {
|
|
208
251
|
id: existing ? existing.id : newAppId(),
|
|
209
252
|
// the label is the one field a redeploy inherits: everything else is
|
|
210
253
|
// what this publish states
|
|
211
|
-
name
|
|
254
|
+
name,
|
|
212
255
|
appLoc,
|
|
213
256
|
streamWebFolder,
|
|
214
257
|
...(logo === undefined ? {} : { logo }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../src/appstream/web.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpE,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,SAAS,CAAA;AAEtC,iFAAiF;AACjF,eAAO,MAAM,WAAW,0CAA0C,CAAA;AAElE,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAA;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,IAAI,EAAE,MAAM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AAM,UAAU,GAAI,OAAO,MAAM,KAAG,MACmB,CAAA;AA2B9D,qEAAqE;AACrE,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,MAIjD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,MAGT,CAAA;AAmC1C,eAAO,MAAM,yBAAyB,GACpC,WAAW,gBAAgB,EAC3B,OAAO,YAAY,EACnB,UAAS,mBAAwB,KAChC,mBAoLF,CAAA"}
|
|
@@ -150,9 +150,13 @@ export const createAppStreamWebService = (appStream, drive, options = {}) => {
|
|
|
150
150
|
].join(''));
|
|
151
151
|
};
|
|
152
152
|
/**
|
|
153
|
-
* The app a URL segment names: its id, or
|
|
154
|
-
*
|
|
155
|
-
*
|
|
153
|
+
* The app a URL segment names: its id, or its label when one app alone holds
|
|
154
|
+
* that label. The label is a real address, not a convenience - `/app/<name>`
|
|
155
|
+
* is the readable form of an app's URL - and the publish side keeps it usable
|
|
156
|
+
* by validating a stated name as a URL segment and refusing one another app
|
|
157
|
+
* holds. An ambiguous label still resolves to nothing, because a label derived
|
|
158
|
+
* from a folder has no uniqueness rule of its own, and guessing which of two
|
|
159
|
+
* same-named apps a URL meant is worse than a 404.
|
|
156
160
|
*/
|
|
157
161
|
const resolve = async (segment, allow) => {
|
|
158
162
|
const entries = await appStream.list(allow);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sasjs/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SASjs",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"test": "jest --coverage",
|
|
39
39
|
"coverage:comment": "node scripts/coverage-comment.mjs",
|
|
40
40
|
"test:watch": "jest --watch",
|
|
41
|
-
"lint": "prettier --check \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
|
|
42
|
-
"lint:fix": "prettier --write \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
|
|
41
|
+
"lint": "prettier --check \"{src,spec,scripts,tools}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
|
|
42
|
+
"lint:fix": "prettier --write \"{src,spec,scripts,tools}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
|
|
43
43
|
"sync:routes": "node scripts/sync-routes.mjs",
|
|
44
44
|
"check:routes": "node scripts/sync-routes.mjs --check",
|
|
45
45
|
"audit:gate": "node scripts/audit.mjs",
|