@daffodil/core 0.78.0 → 0.80.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.
@@ -409,17 +409,131 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
409
409
  }]
410
410
  }] });
411
411
 
412
- const DaffPersistenceServiceToken = new InjectionToken('DaffPersistenceService', {
412
+ /**
413
+ * Creates an injection token/provider pair for a single valued DI token.
414
+ *
415
+ * See {@link DaffSingleInjectionToken}.
416
+ */
417
+ const createSingleInjectionToken = (desc, options) => {
418
+ const token = new InjectionToken(desc, options);
419
+ const provider = (value) => ({
420
+ provide: token,
421
+ useValue: value,
422
+ });
423
+ return {
424
+ token,
425
+ provider,
426
+ };
427
+ };
428
+
429
+ // having a single instance of the default factory
430
+ // will hopefully reduce memory footprint
431
+ const defaultFactory$1 = () => [];
432
+ /**
433
+ * Creates an injection token/provider pair for a multi valued DI token.
434
+ *
435
+ * See {@link DaffMultiInjectionToken}.
436
+ */
437
+ const createMultiInjectionToken = (desc, options) => {
438
+ const token = new InjectionToken(desc, {
439
+ factory: defaultFactory$1,
440
+ ...options,
441
+ });
442
+ const provider = (...values) => values.map((value) => ({
443
+ provide: token,
444
+ useValue: value,
445
+ multi: true,
446
+ }));
447
+ return {
448
+ token,
449
+ provider,
450
+ };
451
+ };
452
+
453
+ /**
454
+ * Creates an injection token/provider pair for a DI token that holds a configuration.
455
+ *
456
+ * See {@link DaffConfigInjectionToken}.
457
+ */
458
+ const createConfigInjectionToken = (defaultConfig, desc, options) => {
459
+ const token = new InjectionToken(desc, {
460
+ factory: () => defaultConfig instanceof InjectionToken ? inject(defaultConfig) : defaultConfig,
461
+ ...options,
462
+ });
463
+ const provider = (config) => ({
464
+ provide: token,
465
+ useFactory: () => ({
466
+ ...(defaultConfig instanceof InjectionToken ? inject(defaultConfig) : defaultConfig),
467
+ ...(config instanceof InjectionToken ? inject(config) : config),
468
+ }),
469
+ });
470
+ return {
471
+ token,
472
+ provider,
473
+ };
474
+ };
475
+
476
+ // having a single instance of the default factory
477
+ // will hopefully reduce memory footprint
478
+ const defaultFactory = () => [];
479
+ /**
480
+ * Creates an injection token/provider pair for a DI token that holds services.
481
+ *
482
+ * See {@link DaffServicesInjectionToken}.
483
+ */
484
+ const createServicesInjectionToken = (desc, options) => {
485
+ const token = new InjectionToken(desc, {
486
+ factory: defaultFactory,
487
+ ...options,
488
+ });
489
+ const provider = (...classes) => classes.map((klass) => ({
490
+ provide: token,
491
+ useExisting: klass,
492
+ multi: true,
493
+ }));
494
+ return {
495
+ token,
496
+ provider,
497
+ };
498
+ };
499
+
500
+ /**
501
+ * Creates an injection token/provider pair for a DI token that holds a singleton service.
502
+ *
503
+ * See {@link DaffSingletonInjectionToken}.
504
+ */
505
+ const createSingletonInjectionToken = (desc, options) => {
506
+ const token = new InjectionToken(desc, options);
507
+ const provider = (klass) => ({
508
+ provide: token,
509
+ useExisting: klass,
510
+ });
511
+ return {
512
+ token,
513
+ provider,
514
+ };
515
+ };
516
+
517
+ const { token: DaffPersistenceServiceToken,
518
+ /**
519
+ * Provider function for {@link DaffPersistenceServiceToken}.
520
+ */
521
+ provider: provideDaffPersistenceService, } = createSingleInjectionToken('DaffPersistenceServiceToken', {
413
522
  providedIn: 'root',
414
523
  factory: () => isPlatformBrowser(inject(PLATFORM_ID))
415
524
  ? new DaffLocalStorageService(inject(PLATFORM_ID))
416
525
  : new DaffServerErrorStorageService(),
417
526
  });
418
527
 
528
+ const {
419
529
  /**
420
530
  * Provides noop for the persistence service on the server.
421
531
  */
422
- const DaffServerSafePersistenceServiceToken = new InjectionToken('DaffServerSafePersistenceService', {
532
+ token: DaffServerSafePersistenceServiceToken,
533
+ /**
534
+ * Provider function for {@link DaffServerSafePersistenceServiceToken}.
535
+ */
536
+ provider: provideDaffServerSafePersistenceServiceToken, } = createSingleInjectionToken('DaffServerSafePersistenceService', {
423
537
  providedIn: 'root',
424
538
  factory: () => isPlatformBrowser(inject(PLATFORM_ID))
425
539
  ? inject(DaffPersistenceServiceToken)
@@ -516,10 +630,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
516
630
  args: [PLATFORM_ID]
517
631
  }] }] });
518
632
 
633
+ const {
519
634
  /**
520
635
  * A token which creates a base64 service appropriate for the current environment, i.e., browser vs. server.
521
636
  */
522
- const DaffBase64ServiceToken = new InjectionToken('DaffBase64Service', {
637
+ token: DaffBase64ServiceToken,
638
+ /**
639
+ * Provider function for {@link DaffBase64ServiceToken}.
640
+ */
641
+ provider: provideDaffBase64Service, } = createSingleInjectionToken('DaffBase64ServiceToken', {
523
642
  providedIn: 'root',
524
643
  factory: () => isPlatformBrowser(inject(PLATFORM_ID))
525
644
  ? new DaffBrowserBase64Service(inject(PLATFORM_ID))
@@ -1117,97 +1236,9 @@ const daffCollectionBuildRequestFromMetadata = (metadata) => ({
1117
1236
  */
1118
1237
  const daffIdentifiableArrayToDict = (ary) => daffArrayToDict(ary, ({ id }) => id);
1119
1238
 
1120
- /**
1121
- * Creates an injection token/provider pair for a single valued DI token.
1122
- *
1123
- * See {@link DaffSingleInjectionToken}.
1124
- */
1125
- const createSingleInjectionToken = (desc, options) => {
1126
- const token = new InjectionToken(desc, options);
1127
- const provider = (value) => ({
1128
- provide: token,
1129
- useValue: value,
1130
- });
1131
- return {
1132
- token,
1133
- provider,
1134
- };
1135
- };
1136
-
1137
- // having a single instance of the default factory
1138
- // will hopefully reduce memory footprint
1139
- const defaultFactory$1 = () => [];
1140
- /**
1141
- * Creates an injection token/provider pair for a multi valued DI token.
1142
- *
1143
- * See {@link DaffMultiInjectionToken}.
1144
- */
1145
- const createMultiInjectionToken = (desc, options) => {
1146
- const token = new InjectionToken(desc, {
1147
- factory: defaultFactory$1,
1148
- ...options,
1149
- });
1150
- const provider = (...values) => values.map((value) => ({
1151
- provide: token,
1152
- useValue: value,
1153
- multi: true,
1154
- }));
1155
- return {
1156
- token,
1157
- provider,
1158
- };
1159
- };
1160
-
1161
- /**
1162
- * Creates an injection token/provider pair for a DI token that holds a configuration.
1163
- *
1164
- * See {@link DaffConfigInjectionToken}.
1165
- */
1166
- const createConfigInjectionToken = (defaultConfig, desc, options) => {
1167
- const token = new InjectionToken(desc, {
1168
- factory: () => defaultConfig,
1169
- ...options,
1170
- });
1171
- const provider = (config) => ({
1172
- provide: token,
1173
- useValue: {
1174
- ...defaultConfig,
1175
- ...config,
1176
- },
1177
- });
1178
- return {
1179
- token,
1180
- provider,
1181
- };
1182
- };
1183
-
1184
- // having a single instance of the default factory
1185
- // will hopefully reduce memory footprint
1186
- const defaultFactory = () => [];
1187
- /**
1188
- * Creates an injection token/provider pair for a DI token that holds services.
1189
- *
1190
- * See {@link DaffServicesInjectionToken}.
1191
- */
1192
- const createServicesInjectionToken = (desc, options) => {
1193
- const token = new InjectionToken(desc, {
1194
- factory: defaultFactory,
1195
- ...options,
1196
- });
1197
- const provider = (...classes) => classes.map((klass) => ({
1198
- provide: token,
1199
- useExisting: klass,
1200
- multi: true,
1201
- }));
1202
- return {
1203
- token,
1204
- provider,
1205
- };
1206
- };
1207
-
1208
1239
  /**
1209
1240
  * Generated bundle index. Do not edit.
1210
1241
  */
1211
1242
 
1212
- export { DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE, DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE, DAFF_STORAGE_SERVICE_ERROR_CODE, DaffBase64ServiceToken, DaffBrowserBase64Service, DaffCollectionPageOutOfBoundsError, DaffErrorStorageService, DaffFilterFromToFilterSeparator, DaffFilterNotFound, DaffFilterRequestNameMismatch, DaffFilterRequestTypeMismatch, DaffFilterType, DaffFilterUnknownType, DaffInheritableError, DaffLocalStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerBase64Service, DaffServerErrorStorageService, DaffServerSafePersistenceServiceToken, DaffServerSideStorageError, DaffSortDirectionEnum, DaffStorageServiceError, allOf, anyOf, backoff, catchAndArrayifyErrors, collect, createConfigInjectionToken, createMultiInjectionToken, createServicesInjectionToken, createSingleInjectionToken, daffAdd, daffApplyFilter, daffApplyRequestToFilters, daffApplyRequestsToFilters, daffArrayToDict, daffClearFilter, daffClearFilters, daffCollectionBuildMetadataFromRequest, daffCollectionBuildRequestFromMetadata, daffCollectionErrorMap, daffComputeAppliedFilters, daffDivide, daffFilterArrayToDict, daffFilterComputeRangePairLabel, daffFilterEqualOptionArrayToDict, daffFilterFindAppliedOptions, daffFilterRangePairArrayToDict, daffFilterToRequest, daffFilterValidateRequestNameMatch, daffFilterValidateRequestTypeMatch, daffFiltersToRequests, daffIdentifiableArrayToDict, daffIsError, daffIsFilterApplied, daffIsToggleRequestAppliedToFilter, daffMultiply, daffPrecision, daffRemoveFilter, daffRemoveRequestFromFilters, daffRemoveRequestsFromFilters, daffSubtract, daffToggleFilter, daffToggleRequestOnFilters, identity, observe, randomSlice, randomSubset, range, sample, shallowCompare, shuffle, unique };
1243
+ export { DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE, DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE, DAFF_STORAGE_SERVICE_ERROR_CODE, DaffBase64ServiceToken, DaffBrowserBase64Service, DaffCollectionPageOutOfBoundsError, DaffErrorStorageService, DaffFilterFromToFilterSeparator, DaffFilterNotFound, DaffFilterRequestNameMismatch, DaffFilterRequestTypeMismatch, DaffFilterType, DaffFilterUnknownType, DaffInheritableError, DaffLocalStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerBase64Service, DaffServerErrorStorageService, DaffServerSafePersistenceServiceToken, DaffServerSideStorageError, DaffSortDirectionEnum, DaffStorageServiceError, allOf, anyOf, backoff, catchAndArrayifyErrors, collect, createConfigInjectionToken, createMultiInjectionToken, createServicesInjectionToken, createSingleInjectionToken, createSingletonInjectionToken, daffAdd, daffApplyFilter, daffApplyRequestToFilters, daffApplyRequestsToFilters, daffArrayToDict, daffClearFilter, daffClearFilters, daffCollectionBuildMetadataFromRequest, daffCollectionBuildRequestFromMetadata, daffCollectionErrorMap, daffComputeAppliedFilters, daffDivide, daffFilterArrayToDict, daffFilterComputeRangePairLabel, daffFilterEqualOptionArrayToDict, daffFilterFindAppliedOptions, daffFilterRangePairArrayToDict, daffFilterToRequest, daffFilterValidateRequestNameMatch, daffFilterValidateRequestTypeMatch, daffFiltersToRequests, daffIdentifiableArrayToDict, daffIsError, daffIsFilterApplied, daffIsToggleRequestAppliedToFilter, daffMultiply, daffPrecision, daffRemoveFilter, daffRemoveRequestFromFilters, daffRemoveRequestsFromFilters, daffSubtract, daffToggleFilter, daffToggleRequestOnFilters, identity, observe, randomSlice, randomSubset, range, sample, shallowCompare, shuffle, unique };
1213
1244
  //# sourceMappingURL=daffodil-core.mjs.map