@timeback/core 0.1.7-beta.20260223234236 → 0.1.7-beta.20260224173034
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.js +410 -2
- package/dist/utils.js +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1891,6 +1891,11 @@ class InputValidationError extends ApiError {
|
|
|
1891
1891
|
function createInputValidationError(message, issues) {
|
|
1892
1892
|
return new InputValidationError(message, issues);
|
|
1893
1893
|
}
|
|
1894
|
+
function isApiError(error) {
|
|
1895
|
+
if (!(error instanceof Error))
|
|
1896
|
+
return false;
|
|
1897
|
+
return "statusCode" in error && "response" in error;
|
|
1898
|
+
}
|
|
1894
1899
|
var MAX_RETRIES = 3;
|
|
1895
1900
|
var RETRY_STATUS_CODES = [429, 503];
|
|
1896
1901
|
var INITIAL_RETRY_DELAY_MS = 1000;
|
|
@@ -1930,6 +1935,17 @@ class BaseTransport {
|
|
|
1930
1935
|
const response = await this.requestRaw(path, options);
|
|
1931
1936
|
return this.handleResponse(response);
|
|
1932
1937
|
}
|
|
1938
|
+
async exists(path, options = {}) {
|
|
1939
|
+
try {
|
|
1940
|
+
await this.requestRaw(path, options);
|
|
1941
|
+
return true;
|
|
1942
|
+
} catch (error) {
|
|
1943
|
+
if (isApiError(error) && error.statusCode === 404) {
|
|
1944
|
+
return false;
|
|
1945
|
+
}
|
|
1946
|
+
throw error;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1933
1949
|
async requestRaw(path, options = {}) {
|
|
1934
1950
|
const { method = "GET", params, body, headers = {} } = options;
|
|
1935
1951
|
const url = this.buildUrl(path, params);
|
|
@@ -19255,6 +19271,11 @@ class InputValidationError2 extends ApiError2 {
|
|
|
19255
19271
|
function createInputValidationError2(message, issues) {
|
|
19256
19272
|
return new InputValidationError2(message, issues);
|
|
19257
19273
|
}
|
|
19274
|
+
function isApiError2(error48) {
|
|
19275
|
+
if (!(error48 instanceof Error))
|
|
19276
|
+
return false;
|
|
19277
|
+
return "statusCode" in error48 && "response" in error48;
|
|
19278
|
+
}
|
|
19258
19279
|
var MAX_RETRIES2 = 3;
|
|
19259
19280
|
var RETRY_STATUS_CODES2 = [429, 503];
|
|
19260
19281
|
var INITIAL_RETRY_DELAY_MS2 = 1000;
|
|
@@ -19294,6 +19315,17 @@ class BaseTransport2 {
|
|
|
19294
19315
|
const response = await this.requestRaw(path, options);
|
|
19295
19316
|
return this.handleResponse(response);
|
|
19296
19317
|
}
|
|
19318
|
+
async exists(path, options = {}) {
|
|
19319
|
+
try {
|
|
19320
|
+
await this.requestRaw(path, options);
|
|
19321
|
+
return true;
|
|
19322
|
+
} catch (error48) {
|
|
19323
|
+
if (isApiError2(error48) && error48.statusCode === 404) {
|
|
19324
|
+
return false;
|
|
19325
|
+
}
|
|
19326
|
+
throw error48;
|
|
19327
|
+
}
|
|
19328
|
+
}
|
|
19297
19329
|
async requestRaw(path, options = {}) {
|
|
19298
19330
|
const { method = "GET", params, body, headers = {} } = options;
|
|
19299
19331
|
const url2 = this.buildUrl(path, params);
|
|
@@ -34697,6 +34729,17 @@ class PackagesResource {
|
|
|
34697
34729
|
headers: { "Content-Type": "application/json" }
|
|
34698
34730
|
});
|
|
34699
34731
|
}
|
|
34732
|
+
async upsert(sourcedId, input) {
|
|
34733
|
+
validateNonEmptyString2(sourcedId, "sourcedId");
|
|
34734
|
+
try {
|
|
34735
|
+
return await this.update(sourcedId, input);
|
|
34736
|
+
} catch (error482) {
|
|
34737
|
+
if (isApiError2(error482) && error482.statusCode === 404) {
|
|
34738
|
+
return await this.create(input);
|
|
34739
|
+
}
|
|
34740
|
+
throw error482;
|
|
34741
|
+
}
|
|
34742
|
+
}
|
|
34700
34743
|
get(sourcedId) {
|
|
34701
34744
|
validateNonEmptyString2(sourcedId, "sourcedId");
|
|
34702
34745
|
return this.transport.request(`${this.transport.paths.base}/CFPackages/${encodeURIComponent(sourcedId)}`);
|
|
@@ -36228,6 +36271,11 @@ class InputValidationError3 extends ApiError3 {
|
|
|
36228
36271
|
function createInputValidationError3(message, issues) {
|
|
36229
36272
|
return new InputValidationError3(message, issues);
|
|
36230
36273
|
}
|
|
36274
|
+
function isApiError3(error50) {
|
|
36275
|
+
if (!(error50 instanceof Error))
|
|
36276
|
+
return false;
|
|
36277
|
+
return "statusCode" in error50 && "response" in error50;
|
|
36278
|
+
}
|
|
36231
36279
|
var MAX_RETRIES3 = 3;
|
|
36232
36280
|
var RETRY_STATUS_CODES3 = [429, 503];
|
|
36233
36281
|
var INITIAL_RETRY_DELAY_MS3 = 1000;
|
|
@@ -36267,6 +36315,17 @@ class BaseTransport3 {
|
|
|
36267
36315
|
const response = await this.requestRaw(path, options);
|
|
36268
36316
|
return this.handleResponse(response);
|
|
36269
36317
|
}
|
|
36318
|
+
async exists(path, options = {}) {
|
|
36319
|
+
try {
|
|
36320
|
+
await this.requestRaw(path, options);
|
|
36321
|
+
return true;
|
|
36322
|
+
} catch (error50) {
|
|
36323
|
+
if (isApiError3(error50) && error50.statusCode === 404) {
|
|
36324
|
+
return false;
|
|
36325
|
+
}
|
|
36326
|
+
throw error50;
|
|
36327
|
+
}
|
|
36328
|
+
}
|
|
36270
36329
|
async requestRaw(path, options = {}) {
|
|
36271
36330
|
const { method = "GET", params, body, headers = {} } = options;
|
|
36272
36331
|
const url3 = this.buildUrl(path, params);
|
|
@@ -53120,6 +53179,11 @@ class InputValidationError4 extends ApiError4 {
|
|
|
53120
53179
|
function createInputValidationError4(message, issues) {
|
|
53121
53180
|
return new InputValidationError4(message, issues);
|
|
53122
53181
|
}
|
|
53182
|
+
function isApiError4(error51) {
|
|
53183
|
+
if (!(error51 instanceof Error))
|
|
53184
|
+
return false;
|
|
53185
|
+
return "statusCode" in error51 && "response" in error51;
|
|
53186
|
+
}
|
|
53123
53187
|
var MAX_RETRIES4 = 3;
|
|
53124
53188
|
var RETRY_STATUS_CODES4 = [429, 503];
|
|
53125
53189
|
var INITIAL_RETRY_DELAY_MS4 = 1000;
|
|
@@ -53159,6 +53223,17 @@ class BaseTransport4 {
|
|
|
53159
53223
|
const response = await this.requestRaw(path, options);
|
|
53160
53224
|
return this.handleResponse(response);
|
|
53161
53225
|
}
|
|
53226
|
+
async exists(path, options = {}) {
|
|
53227
|
+
try {
|
|
53228
|
+
await this.requestRaw(path, options);
|
|
53229
|
+
return true;
|
|
53230
|
+
} catch (error51) {
|
|
53231
|
+
if (isApiError4(error51) && error51.statusCode === 404) {
|
|
53232
|
+
return false;
|
|
53233
|
+
}
|
|
53234
|
+
throw error51;
|
|
53235
|
+
}
|
|
53236
|
+
}
|
|
53162
53237
|
async requestRaw(path, options = {}) {
|
|
53163
53238
|
const { method = "GET", params, body, headers = {} } = options;
|
|
53164
53239
|
const url4 = this.buildUrl(path, params);
|
|
@@ -69869,7 +69944,7 @@ class ValidationError5 extends ApiError5 {
|
|
|
69869
69944
|
super(message, 422, response);
|
|
69870
69945
|
}
|
|
69871
69946
|
}
|
|
69872
|
-
function
|
|
69947
|
+
function isApiError5(error55) {
|
|
69873
69948
|
if (!(error55 instanceof Error))
|
|
69874
69949
|
return false;
|
|
69875
69950
|
return "statusCode" in error55 && "response" in error55;
|
|
@@ -71417,6 +71492,11 @@ class InputValidationError6 extends ApiError6 {
|
|
|
71417
71492
|
function createInputValidationError6(message, issues) {
|
|
71418
71493
|
return new InputValidationError6(message, issues);
|
|
71419
71494
|
}
|
|
71495
|
+
function isApiError6(error55) {
|
|
71496
|
+
if (!(error55 instanceof Error))
|
|
71497
|
+
return false;
|
|
71498
|
+
return "statusCode" in error55 && "response" in error55;
|
|
71499
|
+
}
|
|
71420
71500
|
var MAX_RETRIES6 = 3;
|
|
71421
71501
|
var RETRY_STATUS_CODES6 = [429, 503];
|
|
71422
71502
|
var INITIAL_RETRY_DELAY_MS6 = 1000;
|
|
@@ -71456,6 +71536,17 @@ class BaseTransport6 {
|
|
|
71456
71536
|
const response = await this.requestRaw(path, options);
|
|
71457
71537
|
return this.handleResponse(response);
|
|
71458
71538
|
}
|
|
71539
|
+
async exists(path, options = {}) {
|
|
71540
|
+
try {
|
|
71541
|
+
await this.requestRaw(path, options);
|
|
71542
|
+
return true;
|
|
71543
|
+
} catch (error55) {
|
|
71544
|
+
if (isApiError6(error55) && error55.statusCode === 404) {
|
|
71545
|
+
return false;
|
|
71546
|
+
}
|
|
71547
|
+
throw error55;
|
|
71548
|
+
}
|
|
71549
|
+
}
|
|
71459
71550
|
async requestRaw(path, options = {}) {
|
|
71460
71551
|
const { method = "GET", params, body, headers = {} } = options;
|
|
71461
71552
|
const url5 = this.buildUrl(path, params);
|
|
@@ -87098,6 +87189,10 @@ class BaseResource {
|
|
|
87098
87189
|
const response = await this.transport.request(`${this.basePath}/${sourcedId}`);
|
|
87099
87190
|
return this.unwrapSingle(response);
|
|
87100
87191
|
}
|
|
87192
|
+
exists(sourcedId) {
|
|
87193
|
+
validateSourcedId2(sourcedId, `exists ${this.resourceName}`);
|
|
87194
|
+
return this.transport.exists(`${this.basePath}/${sourcedId}`);
|
|
87195
|
+
}
|
|
87101
87196
|
create(data) {
|
|
87102
87197
|
const schema = this.createSchema;
|
|
87103
87198
|
if (schema) {
|
|
@@ -87111,6 +87206,23 @@ class BaseResource {
|
|
|
87111
87206
|
}
|
|
87112
87207
|
async update(sourcedId, data) {
|
|
87113
87208
|
validateSourcedId2(sourcedId, `update ${this.resourceName}`);
|
|
87209
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87210
|
+
return this.sendUpdate(sourcedId, data);
|
|
87211
|
+
}
|
|
87212
|
+
async upsert(sourcedId, data) {
|
|
87213
|
+
validateSourcedId2(sourcedId, `upsert ${this.resourceName}`);
|
|
87214
|
+
const fullData = { ...data, sourcedId };
|
|
87215
|
+
try {
|
|
87216
|
+
return await this.sendUpdate(sourcedId, fullData);
|
|
87217
|
+
} catch (error482) {
|
|
87218
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87219
|
+
await this.create(fullData);
|
|
87220
|
+
return;
|
|
87221
|
+
}
|
|
87222
|
+
throw error482;
|
|
87223
|
+
}
|
|
87224
|
+
}
|
|
87225
|
+
async sendUpdate(sourcedId, data) {
|
|
87114
87226
|
const schema = this.updateSchema;
|
|
87115
87227
|
if (schema) {
|
|
87116
87228
|
validateWithSchema6(schema, data, `update ${this.resourceName}`);
|
|
@@ -87120,6 +87232,28 @@ class BaseResource {
|
|
|
87120
87232
|
method: "PUT",
|
|
87121
87233
|
body
|
|
87122
87234
|
});
|
|
87235
|
+
return;
|
|
87236
|
+
}
|
|
87237
|
+
async sendUpdateAndReturn(sourcedId, data) {
|
|
87238
|
+
const schema = this.updateSchema;
|
|
87239
|
+
if (schema) {
|
|
87240
|
+
validateWithSchema6(schema, data, `update ${this.resourceName}`);
|
|
87241
|
+
}
|
|
87242
|
+
const body = this.wrapBody(data);
|
|
87243
|
+
const response = await this.transport.request(`${this.basePath}/${sourcedId}`, {
|
|
87244
|
+
method: "PUT",
|
|
87245
|
+
body
|
|
87246
|
+
});
|
|
87247
|
+
return this.unwrapSingle(response);
|
|
87248
|
+
}
|
|
87249
|
+
async ensureExistsForUpdate(sourcedId) {
|
|
87250
|
+
if (!this.serverNativelyUpserts) {
|
|
87251
|
+
return;
|
|
87252
|
+
}
|
|
87253
|
+
const found = await this.exists(sourcedId);
|
|
87254
|
+
if (!found) {
|
|
87255
|
+
throw new NotFoundError6(`${this.resourceName} '${sourcedId}' not found`);
|
|
87256
|
+
}
|
|
87123
87257
|
}
|
|
87124
87258
|
async delete(sourcedId) {
|
|
87125
87259
|
validateSourcedId2(sourcedId, `delete ${this.resourceName}`);
|
|
@@ -87139,6 +87273,9 @@ class BaseResource {
|
|
|
87139
87273
|
get patchSchema() {
|
|
87140
87274
|
return;
|
|
87141
87275
|
}
|
|
87276
|
+
get serverNativelyUpserts() {
|
|
87277
|
+
return false;
|
|
87278
|
+
}
|
|
87142
87279
|
get resourceName() {
|
|
87143
87280
|
return this.wrapKey;
|
|
87144
87281
|
}
|
|
@@ -87186,6 +87323,10 @@ class ReadOnlyResource {
|
|
|
87186
87323
|
}
|
|
87187
87324
|
return this.transform(data);
|
|
87188
87325
|
}
|
|
87326
|
+
exists(sourcedId) {
|
|
87327
|
+
validateSourcedId2(sourcedId, `exists ${this.wrapKey}`);
|
|
87328
|
+
return this.transport.exists(`${this.basePath}/${sourcedId}`);
|
|
87329
|
+
}
|
|
87189
87330
|
transform(entity) {
|
|
87190
87331
|
return entity;
|
|
87191
87332
|
}
|
|
@@ -87203,6 +87344,9 @@ class ScopedAssessmentLineItemResource {
|
|
|
87203
87344
|
const response = await this.transport.request(this.basePath);
|
|
87204
87345
|
return response.assessmentLineItem;
|
|
87205
87346
|
}
|
|
87347
|
+
exists() {
|
|
87348
|
+
return this.transport.exists(this.basePath);
|
|
87349
|
+
}
|
|
87206
87350
|
}
|
|
87207
87351
|
|
|
87208
87352
|
class AssessmentLineItemsResourceImpl extends BaseResource {
|
|
@@ -87228,6 +87372,30 @@ class AssessmentLineItemsResourceImpl extends BaseResource {
|
|
|
87228
87372
|
get updateSchema() {
|
|
87229
87373
|
return OneRosterAssessmentLineItemCreateInput5;
|
|
87230
87374
|
}
|
|
87375
|
+
get serverNativelyUpserts() {
|
|
87376
|
+
return true;
|
|
87377
|
+
}
|
|
87378
|
+
async update(sourcedId, data) {
|
|
87379
|
+
validateSourcedId2(sourcedId, "update assessment line item");
|
|
87380
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87381
|
+
return this.sendUpdateAndReturn(sourcedId, data);
|
|
87382
|
+
}
|
|
87383
|
+
async upsert(sourcedId, data) {
|
|
87384
|
+
validateSourcedId2(sourcedId, "upsert assessment line item");
|
|
87385
|
+
const fullData = {
|
|
87386
|
+
...data,
|
|
87387
|
+
sourcedId
|
|
87388
|
+
};
|
|
87389
|
+
try {
|
|
87390
|
+
return await this.sendUpdateAndReturn(sourcedId, fullData);
|
|
87391
|
+
} catch (error482) {
|
|
87392
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87393
|
+
await this.create(fullData);
|
|
87394
|
+
return this.get(sourcedId);
|
|
87395
|
+
}
|
|
87396
|
+
throw error482;
|
|
87397
|
+
}
|
|
87398
|
+
}
|
|
87231
87399
|
}
|
|
87232
87400
|
function createAssessmentLineItemsResource(transport) {
|
|
87233
87401
|
const impl = new AssessmentLineItemsResourceImpl(transport);
|
|
@@ -87237,8 +87405,10 @@ function createAssessmentLineItemsResource(transport) {
|
|
|
87237
87405
|
callable.first = impl.first.bind(impl);
|
|
87238
87406
|
callable.stream = impl.stream.bind(impl);
|
|
87239
87407
|
callable.get = impl.get.bind(impl);
|
|
87408
|
+
callable.exists = impl.exists.bind(impl);
|
|
87240
87409
|
callable.create = impl.create.bind(impl);
|
|
87241
87410
|
callable.update = impl.update.bind(impl);
|
|
87411
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
87242
87412
|
callable.patch = impl.patch.bind(impl);
|
|
87243
87413
|
callable.delete = impl.delete.bind(impl);
|
|
87244
87414
|
return callable;
|
|
@@ -87267,6 +87437,30 @@ class AssessmentResultsResource extends BaseResource {
|
|
|
87267
87437
|
get updateSchema() {
|
|
87268
87438
|
return OneRosterAssessmentResultCreateInput5;
|
|
87269
87439
|
}
|
|
87440
|
+
get serverNativelyUpserts() {
|
|
87441
|
+
return true;
|
|
87442
|
+
}
|
|
87443
|
+
async update(sourcedId, data) {
|
|
87444
|
+
validateSourcedId2(sourcedId, "update assessment result");
|
|
87445
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87446
|
+
return this.sendUpdateAndReturn(sourcedId, data);
|
|
87447
|
+
}
|
|
87448
|
+
async upsert(sourcedId, data) {
|
|
87449
|
+
validateSourcedId2(sourcedId, "upsert assessment result");
|
|
87450
|
+
const fullData = {
|
|
87451
|
+
...data,
|
|
87452
|
+
sourcedId
|
|
87453
|
+
};
|
|
87454
|
+
try {
|
|
87455
|
+
return await this.sendUpdateAndReturn(sourcedId, fullData);
|
|
87456
|
+
} catch (error482) {
|
|
87457
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87458
|
+
await this.create(fullData);
|
|
87459
|
+
return this.get(sourcedId);
|
|
87460
|
+
}
|
|
87461
|
+
throw error482;
|
|
87462
|
+
}
|
|
87463
|
+
}
|
|
87270
87464
|
}
|
|
87271
87465
|
|
|
87272
87466
|
class ScopedLineItemResource {
|
|
@@ -87281,6 +87475,9 @@ class ScopedLineItemResource {
|
|
|
87281
87475
|
const response = await this.transport.request(this.basePath);
|
|
87282
87476
|
return response.lineItem;
|
|
87283
87477
|
}
|
|
87478
|
+
exists() {
|
|
87479
|
+
return this.transport.exists(this.basePath);
|
|
87480
|
+
}
|
|
87284
87481
|
createResults(results) {
|
|
87285
87482
|
validateWithSchema6(OneRosterBulkResultsInput5, results, "bulk results");
|
|
87286
87483
|
return this.transport.request(`${this.basePath}/results`, {
|
|
@@ -87309,6 +87506,27 @@ class LineItemsResourceImpl extends BaseResource {
|
|
|
87309
87506
|
get updateSchema() {
|
|
87310
87507
|
return OneRosterLineItemCreateInput5;
|
|
87311
87508
|
}
|
|
87509
|
+
get serverNativelyUpserts() {
|
|
87510
|
+
return true;
|
|
87511
|
+
}
|
|
87512
|
+
async update(sourcedId, data) {
|
|
87513
|
+
validateSourcedId2(sourcedId, "update line item");
|
|
87514
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87515
|
+
return this.sendUpdateAndReturn(sourcedId, data);
|
|
87516
|
+
}
|
|
87517
|
+
async upsert(sourcedId, data) {
|
|
87518
|
+
validateSourcedId2(sourcedId, "upsert line item");
|
|
87519
|
+
const fullData = { ...data, sourcedId };
|
|
87520
|
+
try {
|
|
87521
|
+
return await this.sendUpdateAndReturn(sourcedId, fullData);
|
|
87522
|
+
} catch (error482) {
|
|
87523
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87524
|
+
await this.create(fullData);
|
|
87525
|
+
return this.get(sourcedId);
|
|
87526
|
+
}
|
|
87527
|
+
throw error482;
|
|
87528
|
+
}
|
|
87529
|
+
}
|
|
87312
87530
|
}
|
|
87313
87531
|
function createLineItemsResource(transport) {
|
|
87314
87532
|
const impl = new LineItemsResourceImpl(transport);
|
|
@@ -87318,8 +87536,10 @@ function createLineItemsResource(transport) {
|
|
|
87318
87536
|
callable.first = impl.first.bind(impl);
|
|
87319
87537
|
callable.stream = impl.stream.bind(impl);
|
|
87320
87538
|
callable.get = impl.get.bind(impl);
|
|
87539
|
+
callable.exists = impl.exists.bind(impl);
|
|
87321
87540
|
callable.create = impl.create.bind(impl);
|
|
87322
87541
|
callable.update = impl.update.bind(impl);
|
|
87542
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
87323
87543
|
callable.delete = impl.delete.bind(impl);
|
|
87324
87544
|
return callable;
|
|
87325
87545
|
}
|
|
@@ -87343,6 +87563,27 @@ class ResultsResource extends BaseResource {
|
|
|
87343
87563
|
get updateSchema() {
|
|
87344
87564
|
return OneRosterResultCreateInput5;
|
|
87345
87565
|
}
|
|
87566
|
+
get serverNativelyUpserts() {
|
|
87567
|
+
return true;
|
|
87568
|
+
}
|
|
87569
|
+
async update(sourcedId, data) {
|
|
87570
|
+
validateSourcedId2(sourcedId, "update result");
|
|
87571
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87572
|
+
return this.sendUpdateAndReturn(sourcedId, data);
|
|
87573
|
+
}
|
|
87574
|
+
async upsert(sourcedId, data) {
|
|
87575
|
+
validateSourcedId2(sourcedId, "upsert result");
|
|
87576
|
+
const fullData = { ...data, sourcedId };
|
|
87577
|
+
try {
|
|
87578
|
+
return await this.sendUpdateAndReturn(sourcedId, fullData);
|
|
87579
|
+
} catch (error482) {
|
|
87580
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87581
|
+
await this.create(fullData);
|
|
87582
|
+
return this.get(sourcedId);
|
|
87583
|
+
}
|
|
87584
|
+
throw error482;
|
|
87585
|
+
}
|
|
87586
|
+
}
|
|
87346
87587
|
}
|
|
87347
87588
|
|
|
87348
87589
|
class CategoriesResource extends BaseResource {
|
|
@@ -87361,6 +87602,27 @@ class CategoriesResource extends BaseResource {
|
|
|
87361
87602
|
get updateSchema() {
|
|
87362
87603
|
return OneRosterCategoryCreateInput5;
|
|
87363
87604
|
}
|
|
87605
|
+
get serverNativelyUpserts() {
|
|
87606
|
+
return true;
|
|
87607
|
+
}
|
|
87608
|
+
async update(sourcedId, data) {
|
|
87609
|
+
validateSourcedId2(sourcedId, "update category");
|
|
87610
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87611
|
+
return this.sendUpdateAndReturn(sourcedId, data);
|
|
87612
|
+
}
|
|
87613
|
+
async upsert(sourcedId, data) {
|
|
87614
|
+
validateSourcedId2(sourcedId, "upsert category");
|
|
87615
|
+
const fullData = { ...data, sourcedId };
|
|
87616
|
+
try {
|
|
87617
|
+
return await this.sendUpdateAndReturn(sourcedId, fullData);
|
|
87618
|
+
} catch (error482) {
|
|
87619
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87620
|
+
await this.create(fullData);
|
|
87621
|
+
return this.get(sourcedId);
|
|
87622
|
+
}
|
|
87623
|
+
throw error482;
|
|
87624
|
+
}
|
|
87625
|
+
}
|
|
87364
87626
|
}
|
|
87365
87627
|
|
|
87366
87628
|
class ScoreScalesResource extends BaseResource {
|
|
@@ -87379,6 +87641,30 @@ class ScoreScalesResource extends BaseResource {
|
|
|
87379
87641
|
get updateSchema() {
|
|
87380
87642
|
return OneRosterScoreScaleCreateInput5;
|
|
87381
87643
|
}
|
|
87644
|
+
get serverNativelyUpserts() {
|
|
87645
|
+
return true;
|
|
87646
|
+
}
|
|
87647
|
+
async update(sourcedId, data) {
|
|
87648
|
+
validateSourcedId2(sourcedId, "update score scale");
|
|
87649
|
+
await this.ensureExistsForUpdate(sourcedId);
|
|
87650
|
+
return this.sendUpdateAndReturn(sourcedId, data);
|
|
87651
|
+
}
|
|
87652
|
+
async upsert(sourcedId, data) {
|
|
87653
|
+
validateSourcedId2(sourcedId, "upsert score scale");
|
|
87654
|
+
const fullData = {
|
|
87655
|
+
...data,
|
|
87656
|
+
sourcedId
|
|
87657
|
+
};
|
|
87658
|
+
try {
|
|
87659
|
+
return await this.sendUpdateAndReturn(sourcedId, fullData);
|
|
87660
|
+
} catch (error482) {
|
|
87661
|
+
if (isApiError6(error482) && error482.statusCode === 404) {
|
|
87662
|
+
await this.create(fullData);
|
|
87663
|
+
return this.get(sourcedId);
|
|
87664
|
+
}
|
|
87665
|
+
throw error482;
|
|
87666
|
+
}
|
|
87667
|
+
}
|
|
87382
87668
|
}
|
|
87383
87669
|
|
|
87384
87670
|
class ScopedResourceResource {
|
|
@@ -87395,6 +87681,9 @@ class ScopedResourceResource {
|
|
|
87395
87681
|
const response = await this.transport.request(this.basePath);
|
|
87396
87682
|
return response.resource;
|
|
87397
87683
|
}
|
|
87684
|
+
exists() {
|
|
87685
|
+
return this.transport.exists(this.basePath);
|
|
87686
|
+
}
|
|
87398
87687
|
async export() {
|
|
87399
87688
|
const response = await this.transport.requestRaw(`${this.transport.paths.resources}/resources/export/${this.resourceId}`, {
|
|
87400
87689
|
method: "POST",
|
|
@@ -87437,8 +87726,10 @@ function createResourcesResource(transport) {
|
|
|
87437
87726
|
callable.first = impl.first.bind(impl);
|
|
87438
87727
|
callable.stream = impl.stream.bind(impl);
|
|
87439
87728
|
callable.get = impl.get.bind(impl);
|
|
87729
|
+
callable.exists = impl.exists.bind(impl);
|
|
87440
87730
|
callable.create = impl.create.bind(impl);
|
|
87441
87731
|
callable.update = impl.update.bind(impl);
|
|
87732
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
87442
87733
|
callable.delete = impl.delete.bind(impl);
|
|
87443
87734
|
callable.export = impl.export.bind(impl);
|
|
87444
87735
|
return callable;
|
|
@@ -87462,6 +87753,9 @@ class ScopedUserResource {
|
|
|
87462
87753
|
grades: parseGrades(response.user.grades)
|
|
87463
87754
|
};
|
|
87464
87755
|
}
|
|
87756
|
+
exists() {
|
|
87757
|
+
return this.transport.exists(this.basePath);
|
|
87758
|
+
}
|
|
87465
87759
|
async demographics() {
|
|
87466
87760
|
const response = await this.transport.request(`${this.basePath}/demographics`);
|
|
87467
87761
|
return {
|
|
@@ -87553,8 +87847,10 @@ function createUsersResource(transport) {
|
|
|
87553
87847
|
callable.first = impl.first.bind(impl);
|
|
87554
87848
|
callable.stream = impl.stream.bind(impl);
|
|
87555
87849
|
callable.get = impl.get.bind(impl);
|
|
87850
|
+
callable.exists = impl.exists.bind(impl);
|
|
87556
87851
|
callable.create = impl.create.bind(impl);
|
|
87557
87852
|
callable.update = impl.update.bind(impl);
|
|
87853
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
87558
87854
|
callable.delete = impl.delete.bind(impl);
|
|
87559
87855
|
return callable;
|
|
87560
87856
|
}
|
|
@@ -87575,6 +87871,9 @@ class ScopedStudentResource {
|
|
|
87575
87871
|
grades: parseGrades(response.user.grades)
|
|
87576
87872
|
};
|
|
87577
87873
|
}
|
|
87874
|
+
exists() {
|
|
87875
|
+
return this.transport.exists(this.basePath);
|
|
87876
|
+
}
|
|
87578
87877
|
classes(params) {
|
|
87579
87878
|
return this.streamClasses(params).toArray();
|
|
87580
87879
|
}
|
|
@@ -87599,6 +87898,9 @@ class ScopedTeacherResource {
|
|
|
87599
87898
|
grades: parseGrades(response.user.grades)
|
|
87600
87899
|
};
|
|
87601
87900
|
}
|
|
87901
|
+
exists() {
|
|
87902
|
+
return this.transport.exists(this.basePath);
|
|
87903
|
+
}
|
|
87602
87904
|
classes(params) {
|
|
87603
87905
|
return this.streamClasses(params).toArray();
|
|
87604
87906
|
}
|
|
@@ -87633,6 +87935,7 @@ function createStudentsResource(transport) {
|
|
|
87633
87935
|
callable.first = impl.first.bind(impl);
|
|
87634
87936
|
callable.stream = impl.stream.bind(impl);
|
|
87635
87937
|
callable.get = impl.get.bind(impl);
|
|
87938
|
+
callable.exists = impl.exists.bind(impl);
|
|
87636
87939
|
return callable;
|
|
87637
87940
|
}
|
|
87638
87941
|
|
|
@@ -87662,6 +87965,7 @@ function createTeachersResource(transport) {
|
|
|
87662
87965
|
callable.first = impl.first.bind(impl);
|
|
87663
87966
|
callable.stream = impl.stream.bind(impl);
|
|
87664
87967
|
callable.get = impl.get.bind(impl);
|
|
87968
|
+
callable.exists = impl.exists.bind(impl);
|
|
87665
87969
|
return callable;
|
|
87666
87970
|
}
|
|
87667
87971
|
|
|
@@ -87728,6 +88032,9 @@ class ScopedSchoolResource {
|
|
|
87728
88032
|
const response = await this.transport.request(this.basePath);
|
|
87729
88033
|
return response.org;
|
|
87730
88034
|
}
|
|
88035
|
+
exists() {
|
|
88036
|
+
return this.transport.exists(this.basePath);
|
|
88037
|
+
}
|
|
87731
88038
|
class(classId) {
|
|
87732
88039
|
return new ScopedSchoolClassResource(this.transport, this.schoolId, classId);
|
|
87733
88040
|
}
|
|
@@ -87817,8 +88124,10 @@ function createSchoolsResource(transport) {
|
|
|
87817
88124
|
callable.first = impl.first.bind(impl);
|
|
87818
88125
|
callable.stream = impl.stream.bind(impl);
|
|
87819
88126
|
callable.get = impl.get.bind(impl);
|
|
88127
|
+
callable.exists = impl.exists.bind(impl);
|
|
87820
88128
|
callable.create = impl.create.bind(impl);
|
|
87821
88129
|
callable.update = impl.update.bind(impl);
|
|
88130
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
87822
88131
|
callable.delete = impl.delete.bind(impl);
|
|
87823
88132
|
return callable;
|
|
87824
88133
|
}
|
|
@@ -87891,6 +88200,9 @@ class ScopedClassResource {
|
|
|
87891
88200
|
const response = await this.transport.request(this.rosteringPath);
|
|
87892
88201
|
return response.class;
|
|
87893
88202
|
}
|
|
88203
|
+
exists() {
|
|
88204
|
+
return this.transport.exists(this.rosteringPath);
|
|
88205
|
+
}
|
|
87894
88206
|
students(params) {
|
|
87895
88207
|
return this.streamStudents(params).toArray();
|
|
87896
88208
|
}
|
|
@@ -88000,8 +88312,10 @@ function createClassesResource(transport) {
|
|
|
88000
88312
|
callable.first = impl.first.bind(impl);
|
|
88001
88313
|
callable.stream = impl.stream.bind(impl);
|
|
88002
88314
|
callable.get = impl.get.bind(impl);
|
|
88315
|
+
callable.exists = impl.exists.bind(impl);
|
|
88003
88316
|
callable.create = impl.create.bind(impl);
|
|
88004
88317
|
callable.update = impl.update.bind(impl);
|
|
88318
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
88005
88319
|
callable.delete = impl.delete.bind(impl);
|
|
88006
88320
|
return callable;
|
|
88007
88321
|
}
|
|
@@ -88020,6 +88334,9 @@ class ScopedCourseResource {
|
|
|
88020
88334
|
const response = await this.transport.request(this.basePath);
|
|
88021
88335
|
return response.course;
|
|
88022
88336
|
}
|
|
88337
|
+
exists() {
|
|
88338
|
+
return this.transport.exists(this.basePath);
|
|
88339
|
+
}
|
|
88023
88340
|
classes(params) {
|
|
88024
88341
|
return this.streamClasses(params).toArray();
|
|
88025
88342
|
}
|
|
@@ -88150,8 +88467,10 @@ function createCoursesResource(transport) {
|
|
|
88150
88467
|
callable.first = impl.first.bind(impl);
|
|
88151
88468
|
callable.stream = impl.stream.bind(impl);
|
|
88152
88469
|
callable.get = impl.get.bind(impl);
|
|
88470
|
+
callable.exists = impl.exists.bind(impl);
|
|
88153
88471
|
callable.create = impl.create.bind(impl);
|
|
88154
88472
|
callable.update = impl.update.bind(impl);
|
|
88473
|
+
callable.upsert = impl.upsert.bind(impl);
|
|
88155
88474
|
callable.delete = impl.delete.bind(impl);
|
|
88156
88475
|
callable.components = impl.components.bind(impl);
|
|
88157
88476
|
callable.streamComponents = impl.streamComponents.bind(impl);
|
|
@@ -88236,6 +88555,9 @@ class ScopedTermResource {
|
|
|
88236
88555
|
const response = await this.transport.request(this.basePath);
|
|
88237
88556
|
return response.term;
|
|
88238
88557
|
}
|
|
88558
|
+
exists() {
|
|
88559
|
+
return this.transport.exists(this.basePath);
|
|
88560
|
+
}
|
|
88239
88561
|
classes(params) {
|
|
88240
88562
|
return this.streamClasses(params).toArray();
|
|
88241
88563
|
}
|
|
@@ -88288,6 +88610,7 @@ function createTermsResource(transport) {
|
|
|
88288
88610
|
callable.first = impl.first.bind(impl);
|
|
88289
88611
|
callable.stream = impl.stream.bind(impl);
|
|
88290
88612
|
callable.get = impl.get.bind(impl);
|
|
88613
|
+
callable.exists = impl.exists.bind(impl);
|
|
88291
88614
|
return callable;
|
|
88292
88615
|
}
|
|
88293
88616
|
|
|
@@ -89888,6 +90211,11 @@ class InputValidationError7 extends ApiError7 {
|
|
|
89888
90211
|
function createInputValidationError7(message, issues) {
|
|
89889
90212
|
return new InputValidationError7(message, issues);
|
|
89890
90213
|
}
|
|
90214
|
+
function isApiError7(error57) {
|
|
90215
|
+
if (!(error57 instanceof Error))
|
|
90216
|
+
return false;
|
|
90217
|
+
return "statusCode" in error57 && "response" in error57;
|
|
90218
|
+
}
|
|
89891
90219
|
var MAX_RETRIES7 = 3;
|
|
89892
90220
|
var RETRY_STATUS_CODES7 = [429, 503];
|
|
89893
90221
|
var INITIAL_RETRY_DELAY_MS7 = 1000;
|
|
@@ -89927,6 +90255,17 @@ class BaseTransport7 {
|
|
|
89927
90255
|
const response = await this.requestRaw(path, options);
|
|
89928
90256
|
return this.handleResponse(response);
|
|
89929
90257
|
}
|
|
90258
|
+
async exists(path, options = {}) {
|
|
90259
|
+
try {
|
|
90260
|
+
await this.requestRaw(path, options);
|
|
90261
|
+
return true;
|
|
90262
|
+
} catch (error57) {
|
|
90263
|
+
if (isApiError7(error57) && error57.statusCode === 404) {
|
|
90264
|
+
return false;
|
|
90265
|
+
}
|
|
90266
|
+
throw error57;
|
|
90267
|
+
}
|
|
90268
|
+
}
|
|
89930
90269
|
async requestRaw(path, options = {}) {
|
|
89931
90270
|
const { method = "GET", params, body, headers = {} } = options;
|
|
89932
90271
|
const url6 = this.buildUrl(path, params);
|
|
@@ -107326,6 +107665,11 @@ class InputValidationError8 extends ApiError8 {
|
|
|
107326
107665
|
function createInputValidationError8(message, issues) {
|
|
107327
107666
|
return new InputValidationError8(message, issues);
|
|
107328
107667
|
}
|
|
107668
|
+
function isApiError8(error59) {
|
|
107669
|
+
if (!(error59 instanceof Error))
|
|
107670
|
+
return false;
|
|
107671
|
+
return "statusCode" in error59 && "response" in error59;
|
|
107672
|
+
}
|
|
107329
107673
|
var MAX_RETRIES8 = 3;
|
|
107330
107674
|
var RETRY_STATUS_CODES8 = [429, 503];
|
|
107331
107675
|
var INITIAL_RETRY_DELAY_MS8 = 1000;
|
|
@@ -107365,6 +107709,17 @@ class BaseTransport8 {
|
|
|
107365
107709
|
const response = await this.requestRaw(path, options);
|
|
107366
107710
|
return this.handleResponse(response);
|
|
107367
107711
|
}
|
|
107712
|
+
async exists(path, options = {}) {
|
|
107713
|
+
try {
|
|
107714
|
+
await this.requestRaw(path, options);
|
|
107715
|
+
return true;
|
|
107716
|
+
} catch (error59) {
|
|
107717
|
+
if (isApiError8(error59) && error59.statusCode === 404) {
|
|
107718
|
+
return false;
|
|
107719
|
+
}
|
|
107720
|
+
throw error59;
|
|
107721
|
+
}
|
|
107722
|
+
}
|
|
107368
107723
|
async requestRaw(path, options = {}) {
|
|
107369
107724
|
const { method = "GET", params, body, headers = {} } = options;
|
|
107370
107725
|
const url7 = this.buildUrl(path, params);
|
|
@@ -122985,6 +123340,21 @@ class AssessmentItemsResource {
|
|
|
122985
123340
|
body
|
|
122986
123341
|
});
|
|
122987
123342
|
}
|
|
123343
|
+
async upsert(identifier, body) {
|
|
123344
|
+
validateNonEmptyString6(identifier, "identifier");
|
|
123345
|
+
try {
|
|
123346
|
+
return await this.update(identifier, body);
|
|
123347
|
+
} catch (error482) {
|
|
123348
|
+
if (isApiError8(error482) && error482.statusCode === 404) {
|
|
123349
|
+
const { rawXml: _, content: _c, ...createBody } = body;
|
|
123350
|
+
return await this.create({
|
|
123351
|
+
...createBody,
|
|
123352
|
+
identifier
|
|
123353
|
+
});
|
|
123354
|
+
}
|
|
123355
|
+
throw error482;
|
|
123356
|
+
}
|
|
123357
|
+
}
|
|
122988
123358
|
delete(identifier) {
|
|
122989
123359
|
validateNonEmptyString6(identifier, "identifier");
|
|
122990
123360
|
return this.transport.request(`/assessment-items/${encodeURIComponent(identifier)}`, {
|
|
@@ -123214,6 +123584,17 @@ class AssessmentTestsResource {
|
|
|
123214
123584
|
body
|
|
123215
123585
|
});
|
|
123216
123586
|
}
|
|
123587
|
+
async upsert(identifier, body) {
|
|
123588
|
+
validateNonEmptyString6(identifier, "identifier");
|
|
123589
|
+
try {
|
|
123590
|
+
return await this.update(identifier, body);
|
|
123591
|
+
} catch (error482) {
|
|
123592
|
+
if (isApiError8(error482) && error482.statusCode === 404) {
|
|
123593
|
+
return await this.create({ ...body, identifier });
|
|
123594
|
+
}
|
|
123595
|
+
throw error482;
|
|
123596
|
+
}
|
|
123597
|
+
}
|
|
123217
123598
|
delete(identifier) {
|
|
123218
123599
|
validateNonEmptyString6(identifier, "identifier");
|
|
123219
123600
|
return this.transport.request(`/assessment-tests/${encodeURIComponent(identifier)}`, {
|
|
@@ -123319,6 +123700,17 @@ class StimuliResource {
|
|
|
123319
123700
|
body
|
|
123320
123701
|
});
|
|
123321
123702
|
}
|
|
123703
|
+
async upsert(identifier, body) {
|
|
123704
|
+
validateNonEmptyString6(identifier, "identifier");
|
|
123705
|
+
try {
|
|
123706
|
+
return await this.update(identifier, body);
|
|
123707
|
+
} catch (error482) {
|
|
123708
|
+
if (isApiError8(error482) && error482.statusCode === 404) {
|
|
123709
|
+
return await this.create({ ...body, identifier });
|
|
123710
|
+
}
|
|
123711
|
+
throw error482;
|
|
123712
|
+
}
|
|
123713
|
+
}
|
|
123322
123714
|
delete(identifier) {
|
|
123323
123715
|
validateNonEmptyString6(identifier, "identifier");
|
|
123324
123716
|
return this.transport.request(`/stimuli/${encodeURIComponent(identifier)}`, {
|
|
@@ -124872,6 +125264,11 @@ class InputValidationError9 extends ApiError9 {
|
|
|
124872
125264
|
function createInputValidationError9(message, issues) {
|
|
124873
125265
|
return new InputValidationError9(message, issues);
|
|
124874
125266
|
}
|
|
125267
|
+
function isApiError9(error60) {
|
|
125268
|
+
if (!(error60 instanceof Error))
|
|
125269
|
+
return false;
|
|
125270
|
+
return "statusCode" in error60 && "response" in error60;
|
|
125271
|
+
}
|
|
124875
125272
|
var MAX_RETRIES9 = 3;
|
|
124876
125273
|
var RETRY_STATUS_CODES9 = [429, 503];
|
|
124877
125274
|
var INITIAL_RETRY_DELAY_MS9 = 1000;
|
|
@@ -124911,6 +125308,17 @@ class BaseTransport9 {
|
|
|
124911
125308
|
const response = await this.requestRaw(path, options);
|
|
124912
125309
|
return this.handleResponse(response);
|
|
124913
125310
|
}
|
|
125311
|
+
async exists(path, options = {}) {
|
|
125312
|
+
try {
|
|
125313
|
+
await this.requestRaw(path, options);
|
|
125314
|
+
return true;
|
|
125315
|
+
} catch (error60) {
|
|
125316
|
+
if (isApiError9(error60) && error60.statusCode === 404) {
|
|
125317
|
+
return false;
|
|
125318
|
+
}
|
|
125319
|
+
throw error60;
|
|
125320
|
+
}
|
|
125321
|
+
}
|
|
124914
125322
|
async requestRaw(path, options = {}) {
|
|
124915
125323
|
const { method = "GET", params, body, headers = {} } = options;
|
|
124916
125324
|
const url8 = this.buildUrl(path, params);
|
|
@@ -140643,7 +141051,7 @@ class TimebackManager {
|
|
|
140643
141051
|
}
|
|
140644
141052
|
export {
|
|
140645
141053
|
whereToFilter2 as whereToFilter,
|
|
140646
|
-
isApiError,
|
|
141054
|
+
isApiError5 as isApiError,
|
|
140647
141055
|
getServiceUrlsForEnv,
|
|
140648
141056
|
ValidationError5 as ValidationError,
|
|
140649
141057
|
UnauthorizedError5 as UnauthorizedError,
|
package/dist/utils.js
CHANGED
|
@@ -1481,6 +1481,11 @@ class InputValidationError extends ApiError {
|
|
|
1481
1481
|
function createInputValidationError(message, issues) {
|
|
1482
1482
|
return new InputValidationError(message, issues);
|
|
1483
1483
|
}
|
|
1484
|
+
function isApiError(error) {
|
|
1485
|
+
if (!(error instanceof Error))
|
|
1486
|
+
return false;
|
|
1487
|
+
return "statusCode" in error && "response" in error;
|
|
1488
|
+
}
|
|
1484
1489
|
var MAX_RETRIES = 3;
|
|
1485
1490
|
var RETRY_STATUS_CODES = [429, 503];
|
|
1486
1491
|
var INITIAL_RETRY_DELAY_MS = 1000;
|
|
@@ -1520,6 +1525,17 @@ class BaseTransport {
|
|
|
1520
1525
|
const response = await this.requestRaw(path, options);
|
|
1521
1526
|
return this.handleResponse(response);
|
|
1522
1527
|
}
|
|
1528
|
+
async exists(path, options = {}) {
|
|
1529
|
+
try {
|
|
1530
|
+
await this.requestRaw(path, options);
|
|
1531
|
+
return true;
|
|
1532
|
+
} catch (error) {
|
|
1533
|
+
if (isApiError(error) && error.statusCode === 404) {
|
|
1534
|
+
return false;
|
|
1535
|
+
}
|
|
1536
|
+
throw error;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1523
1539
|
async requestRaw(path, options = {}) {
|
|
1524
1540
|
const { method = "GET", params, body, headers = {} } = options;
|
|
1525
1541
|
const url = this.buildUrl(path, params);
|