@kaspernj/api-maker 1.0.2054 → 1.0.2055
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/api.js +64 -212
- package/build/api.js.map +1 -1
- package/build/attribute-not-loaded-error.js +2 -25
- package/build/attribute-not-loaded-error.js.map +1 -1
- package/build/base-component.js +3 -26
- package/build/base-component.js.map +1 -1
- package/build/base-error.js +20 -45
- package/build/base-error.js.map +1 -1
- package/build/base-model/attribute.js +14 -21
- package/build/base-model/attribute.js.map +1 -1
- package/build/base-model/column.js +4 -8
- package/build/base-model/column.js.map +1 -1
- package/build/base-model/reflection.js +11 -51
- package/build/base-model/reflection.js.map +1 -1
- package/build/base-model/scope.js +8 -45
- package/build/base-model/scope.js.map +1 -1
- package/build/base-model.js +583 -836
- package/build/base-model.js.map +1 -1
- package/build/bootstrap/attribute-row.js +87 -172
- package/build/bootstrap/attribute-row.js.map +1 -1
- package/build/bootstrap/attribute-rows.js +21 -50
- package/build/bootstrap/attribute-rows.js.map +1 -1
- package/build/bootstrap/card.js +76 -159
- package/build/bootstrap/card.js.map +1 -1
- package/build/bootstrap/checkbox.js +53 -102
- package/build/bootstrap/checkbox.js.map +1 -1
- package/build/bootstrap/checkboxes.js +116 -202
- package/build/bootstrap/checkboxes.js.map +1 -1
- package/build/bootstrap/input.js +80 -131
- package/build/bootstrap/input.js.map +1 -1
- package/build/bootstrap/invalid-feedback.js +18 -46
- package/build/bootstrap/invalid-feedback.js.map +1 -1
- package/build/bootstrap/paginate.js +99 -164
- package/build/bootstrap/paginate.js.map +1 -1
- package/build/bootstrap/radio-buttons.js +43 -80
- package/build/bootstrap/radio-buttons.js.map +1 -1
- package/build/bootstrap/select.js +43 -90
- package/build/bootstrap/select.js.map +1 -1
- package/build/bootstrap/sort-link.js +68 -151
- package/build/bootstrap/sort-link.js.map +1 -1
- package/build/cable-connection-pool.js +43 -65
- package/build/cable-connection-pool.js.map +1 -1
- package/build/cable-subscription-pool.js +104 -161
- package/build/cable-subscription-pool.js.map +1 -1
- package/build/cable-subscription.js +9 -16
- package/build/cable-subscription.js.map +1 -1
- package/build/cache-key-generator.js +27 -36
- package/build/cache-key-generator.js.map +1 -1
- package/build/can-can.js +80 -201
- package/build/can-can.js.map +1 -1
- package/build/channels-consumer.js +5 -10
- package/build/channels-consumer.js.map +1 -1
- package/build/collection-loader.js +35 -53
- package/build/collection-loader.js.map +1 -1
- package/build/collection.js +160 -307
- package/build/collection.js.map +1 -1
- package/build/command-submit-data.d.ts +1 -1
- package/build/command-submit-data.d.ts.map +1 -1
- package/build/command-submit-data.js +29 -38
- package/build/command-submit-data.js.map +1 -1
- package/build/commands-pool.js +139 -215
- package/build/commands-pool.js.map +1 -1
- package/build/compose.js +3 -11
- package/build/compose.js.map +1 -1
- package/build/config.js +20 -67
- package/build/config.js.map +1 -1
- package/build/custom-error.js +4 -29
- package/build/custom-error.js.map +1 -1
- package/build/data-set-to-attributes.js +5 -41
- package/build/data-set-to-attributes.js.map +1 -1
- package/build/deserializer.js +26 -79
- package/build/deserializer.js.map +1 -1
- package/build/destroy-error.js +4 -29
- package/build/destroy-error.js.map +1 -1
- package/build/devise.js +83 -187
- package/build/devise.js.map +1 -1
- package/build/draggable-sort/controller.js +87 -110
- package/build/draggable-sort/controller.js.map +1 -1
- package/build/draggable-sort/index.js +67 -144
- package/build/draggable-sort/index.js.map +1 -1
- package/build/draggable-sort/item.js +131 -197
- package/build/draggable-sort/item.js.map +1 -1
- package/build/error-logger.js +78 -163
- package/build/error-logger.js.map +1 -1
- package/build/error-messages.js +4 -7
- package/build/error-messages.js.map +1 -1
- package/build/event-connection.js +23 -61
- package/build/event-connection.js.map +1 -1
- package/build/event-emitter-listener.js +6 -23
- package/build/event-emitter-listener.js.map +1 -1
- package/build/event-model-class.js +19 -46
- package/build/event-model-class.js.map +1 -1
- package/build/events.js +3 -8
- package/build/events.js.map +1 -1
- package/build/form.js +65 -153
- package/build/form.js.map +1 -1
- package/build/history-expo.js +12 -24
- package/build/history-expo.js.map +1 -1
- package/build/history-react-native.js +14 -26
- package/build/history-react-native.js.map +1 -1
- package/build/history.js +2 -4
- package/build/history.js.map +1 -1
- package/build/index.js +2 -5
- package/build/index.js.map +1 -1
- package/build/inputs/attachment.js +71 -122
- package/build/inputs/attachment.js.map +1 -1
- package/build/inputs/auto-submit.js +15 -54
- package/build/inputs/auto-submit.js.map +1 -1
- package/build/inputs/checkbox.js +77 -166
- package/build/inputs/checkbox.js.map +1 -1
- package/build/inputs/checkboxes.js +75 -158
- package/build/inputs/checkboxes.js.map +1 -1
- package/build/inputs/id-for-component.js +4 -40
- package/build/inputs/id-for-component.js.map +1 -1
- package/build/inputs/input-wrapper.js +7 -26
- package/build/inputs/input-wrapper.js.map +1 -1
- package/build/inputs/input.js +158 -244
- package/build/inputs/input.js.map +1 -1
- package/build/inputs/money.js +123 -185
- package/build/inputs/money.js.map +1 -1
- package/build/inputs/name-for-component.js +4 -40
- package/build/inputs/name-for-component.js.map +1 -1
- package/build/inputs/select.js +68 -122
- package/build/inputs/select.js.map +1 -1
- package/build/instance-of-class-name.js +15 -20
- package/build/instance-of-class-name.js.map +1 -1
- package/build/is-expo.js +8 -10
- package/build/is-expo.js.map +1 -1
- package/build/key-value-store.js +51 -127
- package/build/key-value-store.js.map +1 -1
- package/build/link.js +51 -114
- package/build/link.js.map +1 -1
- package/build/logger.js +19 -25
- package/build/logger.js.map +1 -1
- package/build/merge-styles.js +5 -9
- package/build/merge-styles.js.map +1 -1
- package/build/modal.js +14 -61
- package/build/modal.js.map +1 -1
- package/build/model-class-require.js +8 -43
- package/build/model-class-require.js.map +1 -1
- package/build/model-events.js +24 -33
- package/build/model-events.js.map +1 -1
- package/build/model-name.js +15 -56
- package/build/model-name.js.map +1 -1
- package/build/model-prop-type.js +51 -62
- package/build/model-prop-type.js.map +1 -1
- package/build/model-recipes-loader.js +16 -24
- package/build/model-recipes-loader.js.map +1 -1
- package/build/model-recipes-model-loader.d.ts +1 -1
- package/build/model-recipes-model-loader.js +129 -207
- package/build/model-recipes-model-loader.js.map +1 -1
- package/build/models-response-reader.js +24 -65
- package/build/models-response-reader.js.map +1 -1
- package/build/models.js +5 -10
- package/build/models.js.map +1 -1
- package/build/money-formatter.d.ts +2 -2
- package/build/money-formatter.d.ts.map +1 -1
- package/build/money-formatter.js +45 -55
- package/build/money-formatter.js.map +1 -1
- package/build/not-loaded-error.js +2 -25
- package/build/not-loaded-error.js.map +1 -1
- package/build/params.js +31 -41
- package/build/params.js.map +1 -1
- package/build/preloaded.js +18 -58
- package/build/preloaded.js.map +1 -1
- package/build/resize-observer.js +5 -11
- package/build/resize-observer.js.map +1 -1
- package/build/rest-props-validator.js +4 -6
- package/build/rest-props-validator.js.map +1 -1
- package/build/result.js +10 -14
- package/build/result.js.map +1 -1
- package/build/router/route.js +178 -311
- package/build/router/route.js.map +1 -1
- package/build/router/switch.js +55 -129
- package/build/router/switch.js.map +1 -1
- package/build/router.js +33 -93
- package/build/router.js.map +1 -1
- package/build/routes-native.js +63 -147
- package/build/routes-native.js.map +1 -1
- package/build/routes.js +25 -79
- package/build/routes.js.map +1 -1
- package/build/run-last.js +19 -24
- package/build/run-last.js.map +1 -1
- package/build/serializer.js +28 -33
- package/build/serializer.js.map +1 -1
- package/build/services.js +9 -18
- package/build/services.js.map +1 -1
- package/build/session-status-updater.js +84 -183
- package/build/session-status-updater.js.map +1 -1
- package/build/source-maps-loader.d.ts +37 -0
- package/build/source-maps-loader.d.ts.map +1 -0
- package/build/source-maps-loader.js +102 -224
- package/build/source-maps-loader.js.map +1 -1
- package/build/super-admin/config-reader.d.ts +2 -2
- package/build/super-admin/config-reader.js +41 -82
- package/build/super-admin/config-reader.js.map +1 -1
- package/build/super-admin/edit-page/edit-attribute-checkbox.js +52 -114
- package/build/super-admin/edit-page/edit-attribute-checkbox.js.map +1 -1
- package/build/super-admin/edit-page/edit-attribute-content.js +46 -76
- package/build/super-admin/edit-page/edit-attribute-content.js.map +1 -1
- package/build/super-admin/edit-page/edit-attribute-input.js +56 -118
- package/build/super-admin/edit-page/edit-attribute-input.js.map +1 -1
- package/build/super-admin/edit-page/edit-attribute.js +39 -103
- package/build/super-admin/edit-page/edit-attribute.js.map +1 -1
- package/build/super-admin/edit-page.js +87 -200
- package/build/super-admin/edit-page.js.map +1 -1
- package/build/super-admin/has-edit-config.js +6 -12
- package/build/super-admin/has-edit-config.js.map +1 -1
- package/build/super-admin/index-page.js +16 -43
- package/build/super-admin/index-page.js.map +1 -1
- package/build/super-admin/index.js +86 -209
- package/build/super-admin/index.js.map +1 -1
- package/build/super-admin/layout/header/index.js +90 -151
- package/build/super-admin/layout/header/index.js.map +1 -1
- package/build/super-admin/layout/index.js +69 -152
- package/build/super-admin/layout/index.js.map +1 -1
- package/build/super-admin/layout/menu/index.js +84 -160
- package/build/super-admin/layout/menu/index.js.map +1 -1
- package/build/super-admin/layout/menu/menu-content.js +24 -84
- package/build/super-admin/layout/menu/menu-content.js.map +1 -1
- package/build/super-admin/layout/menu/menu-item.js +51 -101
- package/build/super-admin/layout/menu/menu-item.js.map +1 -1
- package/build/super-admin/layout/no-access.js +18 -44
- package/build/super-admin/layout/no-access.js.map +1 -1
- package/build/super-admin/model-class-table.js +44 -128
- package/build/super-admin/model-class-table.js.map +1 -1
- package/build/super-admin/models.js +5 -41
- package/build/super-admin/models.js.map +1 -1
- package/build/super-admin/show-nav.js +26 -88
- package/build/super-admin/show-nav.js.map +1 -1
- package/build/super-admin/show-page/belongs-to-attribute-row.js +17 -75
- package/build/super-admin/show-page/belongs-to-attribute-row.js.map +1 -1
- package/build/super-admin/show-page/index.js +100 -186
- package/build/super-admin/show-page/index.js.map +1 -1
- package/build/super-admin/show-reflection-actions.js +38 -99
- package/build/super-admin/show-reflection-actions.js.map +1 -1
- package/build/super-admin/show-reflection-link.js +26 -98
- package/build/super-admin/show-reflection-link.js.map +1 -1
- package/build/super-admin/show-reflection-page.js +33 -96
- package/build/super-admin/show-reflection-page.js.map +1 -1
- package/build/table/column-content.js +76 -120
- package/build/table/column-content.js.map +1 -1
- package/build/table/column-identifier.js +6 -10
- package/build/table/column-identifier.js.map +1 -1
- package/build/table/column-visible.js +1 -4
- package/build/table/column-visible.js.map +1 -1
- package/build/table/components/column.js +12 -59
- package/build/table/components/column.js.map +1 -1
- package/build/table/components/flat-list.js +12 -59
- package/build/table/components/flat-list.js.map +1 -1
- package/build/table/components/header.js +14 -61
- package/build/table/components/header.js.map +1 -1
- package/build/table/components/row.js +15 -62
- package/build/table/components/row.js.map +1 -1
- package/build/table/filters/attribute-element.js +33 -61
- package/build/table/filters/attribute-element.js.map +1 -1
- package/build/table/filters/filter-form.js +279 -482
- package/build/table/filters/filter-form.js.map +1 -1
- package/build/table/filters/filter.js +44 -72
- package/build/table/filters/filter.js.map +1 -1
- package/build/table/filters/index.js +94 -138
- package/build/table/filters/index.js.map +1 -1
- package/build/table/filters/load-search-modal.js +63 -211
- package/build/table/filters/load-search-modal.js.map +1 -1
- package/build/table/filters/reflection-element.js +26 -54
- package/build/table/filters/reflection-element.js.map +1 -1
- package/build/table/filters/save-search-modal.js +43 -139
- package/build/table/filters/save-search-modal.js.map +1 -1
- package/build/table/filters/scope-element.js +27 -55
- package/build/table/filters/scope-element.js.map +1 -1
- package/build/table/header-column-content.js +32 -70
- package/build/table/header-column-content.js.map +1 -1
- package/build/table/header-column.js +88 -217
- package/build/table/header-column.js.map +1 -1
- package/build/table/header-select.js +44 -76
- package/build/table/header-select.js.map +1 -1
- package/build/table/model-callback-args.js +4 -40
- package/build/table/model-callback-args.js.map +1 -1
- package/build/table/model-column.js +58 -143
- package/build/table/model-column.js.map +1 -1
- package/build/table/model-row.js +74 -186
- package/build/table/model-row.js.map +1 -1
- package/build/table/select-calculator.js +26 -85
- package/build/table/select-calculator.js.map +1 -1
- package/build/table/settings/column-row.js +65 -185
- package/build/table/settings/column-row.js.map +1 -1
- package/build/table/settings/download-action.js +37 -73
- package/build/table/settings/download-action.js.map +1 -1
- package/build/table/settings/index.js +37 -101
- package/build/table/settings/index.js.map +1 -1
- package/build/table/table-settings.js +184 -322
- package/build/table/table-settings.js.map +1 -1
- package/build/table/table.js +582 -780
- package/build/table/table.js.map +1 -1
- package/build/table/use-sorting.js +15 -34
- package/build/table/use-sorting.js.map +1 -1
- package/build/table/widths.js +31 -37
- package/build/table/widths.js.map +1 -1
- package/build/table/worker-plugins-check-all-checkbox.js +76 -224
- package/build/table/worker-plugins-check-all-checkbox.js.map +1 -1
- package/build/table/worker-plugins-checkbox.js +73 -184
- package/build/table/worker-plugins-checkbox.js.map +1 -1
- package/build/translated-attributes.js +5 -10
- package/build/translated-attributes.js.map +1 -1
- package/build/translated-collections.js +10 -19
- package/build/translated-collections.js.map +1 -1
- package/build/updated-attribute.js +46 -119
- package/build/updated-attribute.js.map +1 -1
- package/build/url-encode.js +5 -11
- package/build/url-encode.js.map +1 -1
- package/build/use-breakpoint.js +42 -94
- package/build/use-breakpoint.js.map +1 -1
- package/build/use-can-can.js +29 -91
- package/build/use-can-can.js.map +1 -1
- package/build/use-collection.js +118 -228
- package/build/use-collection.js.map +1 -1
- package/build/use-created-event.js +26 -43
- package/build/use-created-event.js.map +1 -1
- package/build/use-current-user-context.js +56 -150
- package/build/use-current-user-context.js.map +1 -1
- package/build/use-current-user.js +13 -31
- package/build/use-current-user.js.map +1 -1
- package/build/use-destroyed-event.js +21 -42
- package/build/use-destroyed-event.js.map +1 -1
- package/build/use-event-emitter.js +9 -14
- package/build/use-event-emitter.js.map +1 -1
- package/build/use-event-listener.js +12 -21
- package/build/use-event-listener.js.map +1 -1
- package/build/use-input.js +48 -68
- package/build/use-input.js.map +1 -1
- package/build/use-model-event.js +21 -42
- package/build/use-model-event.js.map +1 -1
- package/build/use-model.js +95 -198
- package/build/use-model.js.map +1 -1
- package/build/use-resize-observer.js +10 -20
- package/build/use-resize-observer.js.map +1 -1
- package/build/use-router.js +64 -106
- package/build/use-router.js.map +1 -1
- package/build/use-screen-layout.js +16 -18
- package/build/use-screen-layout.js.map +1 -1
- package/build/use-styles.js +23 -74
- package/build/use-styles.js.map +1 -1
- package/build/use-updated-event.js +21 -43
- package/build/use-updated-event.js.map +1 -1
- package/build/use-validation-errors.js +11 -17
- package/build/use-validation-errors.js.map +1 -1
- package/build/utils/button.js +85 -135
- package/build/utils/button.js.map +1 -1
- package/build/utils/card.js +30 -105
- package/build/utils/card.js.map +1 -1
- package/build/utils/checkbox.js +50 -111
- package/build/utils/checkbox.js.map +1 -1
- package/build/utils/checkboxes.js +108 -181
- package/build/utils/checkboxes.js.map +1 -1
- package/build/utils/default-style.js +28 -102
- package/build/utils/default-style.js.map +1 -1
- package/build/utils/header.js +7 -34
- package/build/utils/header.js.map +1 -1
- package/build/utils/icon.js +35 -116
- package/build/utils/icon.js.map +1 -1
- package/build/utils/invalid-feedback.js +15 -42
- package/build/utils/invalid-feedback.js.map +1 -1
- package/build/utils/modal.js +24 -107
- package/build/utils/modal.js.map +1 -1
- package/build/utils/text.js +9 -36
- package/build/utils/text.js.map +1 -1
- package/build/validation-error.js +30 -88
- package/build/validation-error.js.map +1 -1
- package/build/validation-errors.js +60 -110
- package/build/validation-errors.js.map +1 -1
- package/build/with-api-maker.js +14 -66
- package/build/with-api-maker.js.map +1 -1
- package/build/with-collection.js +13 -63
- package/build/with-collection.js.map +1 -1
- package/build/with-current-user.js +6 -22
- package/build/with-current-user.js.map +1 -1
- package/build/with-model.js +10 -26
- package/build/with-model.js.map +1 -1
- package/build/with-router.js +7 -34
- package/build/with-router.js.map +1 -1
- package/package.json +1 -1
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"/src/","sources":["config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"/src/","sources":["config.js"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAA;AACjC,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AAExC,MAAM,SAAS,GAAG;I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array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
var base_error_js_1 = __importDefault(require("./base-error.js"));
|
|
22
|
-
var CustomError = /** @class */ (function (_super) {
|
|
23
|
-
__extends(CustomError, _super);
|
|
24
|
-
function CustomError() {
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
return CustomError;
|
|
28
|
-
}(base_error_js_1.default));
|
|
1
|
+
import BaseError from "./base-error.js";
|
|
2
|
+
class CustomError extends BaseError {
|
|
3
|
+
}
|
|
29
4
|
CustomError.apiMakerType = "CustomError";
|
|
30
|
-
|
|
5
|
+
export default CustomError;
|
|
31
6
|
//# sourceMappingURL=custom-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-error.js","sourceRoot":"/src/","sources":["custom-error.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"custom-error.js","sourceRoot":"/src/","sources":["custom-error.js"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAA;AAEvC,MAAM,WAAY,SAAQ,SAAS;CAAG;AAEtC,WAAW,CAAC,YAAY,GAAG,aAAa,CAAA;AAExC,eAAe,WAAW,CAAA"}
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.default = dataSetToAttributes;
|
|
37
|
-
var inflection = __importStar(require("inflection"));
|
|
38
|
-
function dataSetToAttributes(dataSet) {
|
|
39
|
-
var result = {};
|
|
40
|
-
for (var key in dataSet) {
|
|
41
|
-
var dasherizedKey = "data-".concat(inflection.dasherize(inflection.underscore(key)));
|
|
1
|
+
import * as inflection from "inflection";
|
|
2
|
+
export default function dataSetToAttributes(dataSet) {
|
|
3
|
+
const result = {};
|
|
4
|
+
for (const key in dataSet) {
|
|
5
|
+
const dasherizedKey = `data-${inflection.dasherize(inflection.underscore(key))}`;
|
|
42
6
|
result[dasherizedKey] = dataSet[key];
|
|
43
7
|
}
|
|
44
8
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-set-to-attributes.js","sourceRoot":"/src/","sources":["data-set-to-attributes.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-set-to-attributes.js","sourceRoot":"/src/","sources":["data-set-to-attributes.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AAExC,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,OAAO;IACjD,MAAM,MAAM,GAAG,EAAE,CAAA;IAEjB,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,aAAa,GAAG,QAAQ,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAA;QAEhF,MAAM,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/build/deserializer.js
CHANGED
|
@@ -1,101 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
-
var t = {};
|
|
37
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
-
t[p] = s[p];
|
|
39
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
-
t[p[i]] = s[p[i]];
|
|
43
|
-
}
|
|
44
|
-
return t;
|
|
45
|
-
};
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
var diggerize_1 = require("diggerize");
|
|
51
|
-
var inflection = __importStar(require("inflection"));
|
|
52
|
-
var model_class_require_js_1 = __importDefault(require("./model-class-require.js"));
|
|
53
|
-
var models_response_reader_js_1 = __importDefault(require("./models-response-reader.js"));
|
|
54
|
-
var js_money_1 = __importDefault(require("js-money"));
|
|
55
|
-
var ApiMakerDeserializer = /** @class */ (function () {
|
|
56
|
-
function ApiMakerDeserializer() {
|
|
57
|
-
}
|
|
58
|
-
ApiMakerDeserializer.parse = function (object) {
|
|
1
|
+
import { digg } from "diggerize";
|
|
2
|
+
import * as inflection from "inflection";
|
|
3
|
+
import modelClassRequire from "./model-class-require.js";
|
|
4
|
+
import ModelsResponseReader from "./models-response-reader.js";
|
|
5
|
+
import Money from "js-money";
|
|
6
|
+
export default class ApiMakerDeserializer {
|
|
7
|
+
static parse(object) {
|
|
59
8
|
if (Array.isArray(object)) {
|
|
60
|
-
return object.map(
|
|
9
|
+
return object.map((value) => ApiMakerDeserializer.parse(value));
|
|
61
10
|
}
|
|
62
11
|
else if (object && typeof object == "object") {
|
|
63
12
|
if (object.api_maker_type == "date") {
|
|
64
|
-
|
|
13
|
+
const date = new Date(digg(object, "value"));
|
|
65
14
|
date.apiMakerType = "date";
|
|
66
15
|
return date;
|
|
67
16
|
}
|
|
68
17
|
else if (object.api_maker_type == "time") {
|
|
69
|
-
|
|
18
|
+
const date = new Date(digg(object, "value"));
|
|
70
19
|
date.apiMakerType = "time";
|
|
71
20
|
return date;
|
|
72
21
|
}
|
|
73
22
|
else if (object.api_maker_type == "collection") {
|
|
74
23
|
// Need to remove type to avoid circular error
|
|
75
|
-
|
|
76
|
-
return
|
|
24
|
+
const { api_maker_type, ...restObject } = object;
|
|
25
|
+
return ModelsResponseReader.collection(ApiMakerDeserializer.parse(restObject));
|
|
77
26
|
}
|
|
78
27
|
else if (object.api_maker_type == "money") {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return
|
|
28
|
+
const cents = digg(object, "amount");
|
|
29
|
+
const currency = digg(object, "currency");
|
|
30
|
+
return Money.fromInteger(cents, currency);
|
|
82
31
|
}
|
|
83
32
|
else if (object.api_maker_type == "model") {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
33
|
+
const modelClassName = inflection.classify(digg(object, "model_name"));
|
|
34
|
+
const ModelClass = modelClassRequire(modelClassName);
|
|
35
|
+
const data = ApiMakerDeserializer.parse(digg(object, "serialized"));
|
|
36
|
+
const model = new ModelClass({ data, isNewRecord: false });
|
|
88
37
|
return model;
|
|
89
38
|
}
|
|
90
39
|
else if (object.api_maker_type == "resource") {
|
|
91
|
-
|
|
92
|
-
|
|
40
|
+
const modelClassName = inflection.classify(digg(object, "name"));
|
|
41
|
+
const ModelClass = modelClassRequire(modelClassName);
|
|
93
42
|
return ModelClass;
|
|
94
43
|
}
|
|
95
44
|
else {
|
|
96
|
-
|
|
97
|
-
for (
|
|
98
|
-
|
|
45
|
+
const newObject = {};
|
|
46
|
+
for (const key in object) {
|
|
47
|
+
const value = object[key];
|
|
99
48
|
newObject[key] = ApiMakerDeserializer.parse(value);
|
|
100
49
|
}
|
|
101
50
|
return newObject;
|
|
@@ -104,8 +53,6 @@ var ApiMakerDeserializer = /** @class */ (function () {
|
|
|
104
53
|
else {
|
|
105
54
|
return object;
|
|
106
55
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
}());
|
|
110
|
-
exports.default = ApiMakerDeserializer;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
111
58
|
//# sourceMappingURL=deserializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deserializer.js","sourceRoot":"/src/","sources":["deserializer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deserializer.js","sourceRoot":"/src/","sources":["deserializer.js"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,iBAAiB,MAAM,0BAA0B,CAAA;AACxD,OAAO,oBAAoB,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,MAAM,UAAU,CAAA;AAE5B,MAAM,CAAC,OAAO,OAA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
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
var custom_error_js_1 = __importDefault(require("./custom-error.js"));
|
|
22
|
-
var DestroyError = /** @class */ (function (_super) {
|
|
23
|
-
__extends(DestroyError, _super);
|
|
24
|
-
function DestroyError() {
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
return DestroyError;
|
|
28
|
-
}(custom_error_js_1.default));
|
|
1
|
+
import CustomError from "./custom-error.js";
|
|
2
|
+
class DestroyError extends CustomError {
|
|
3
|
+
}
|
|
29
4
|
DestroyError.apiMakerType = "DestroyError";
|
|
30
|
-
|
|
5
|
+
export default DestroyError;
|
|
31
6
|
//# sourceMappingURL=destroy-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy-error.js","sourceRoot":"/src/","sources":["destroy-error.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"destroy-error.js","sourceRoot":"/src/","sources":["destroy-error.js"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAE3C,MAAM,YAAa,SAAQ,WAAW;CAAG;AAEzC,YAAY,CAAC,YAAY,GAAG,cAAc,CAAA;AAE1C,eAAe,YAAY,CAAA"}
|
package/build/devise.js
CHANGED
|
@@ -1,221 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
-
function step(op) {
|
|
49
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
-
switch (op[0]) {
|
|
54
|
-
case 0: case 1: t = op; break;
|
|
55
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
-
default:
|
|
59
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
-
if (t[2]) _.ops.pop();
|
|
64
|
-
_.trys.pop(); continue;
|
|
65
|
-
}
|
|
66
|
-
op = body.call(thisArg, _);
|
|
67
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
72
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
73
|
-
};
|
|
74
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
var react_1 = require("react");
|
|
76
|
-
var deserializer_js_1 = __importDefault(require("./deserializer.js"));
|
|
77
|
-
var events_js_1 = __importDefault(require("./events.js"));
|
|
78
|
-
var inflection = __importStar(require("inflection"));
|
|
79
|
-
var model_class_require_js_1 = __importDefault(require("./model-class-require.js"));
|
|
80
|
-
var services_js_1 = __importDefault(require("./services.js"));
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
import Deserializer from "./deserializer.js";
|
|
3
|
+
import events from "./events.js";
|
|
4
|
+
import * as inflection from "inflection";
|
|
5
|
+
import modelClassRequire from "./model-class-require.js";
|
|
6
|
+
import Services from "./services.js";
|
|
81
7
|
if (!globalThis.ApiMakerDevise)
|
|
82
8
|
globalThis.ApiMakerDevise = { scopes: {} };
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var _this = this;
|
|
87
|
-
this.getContext = function () { return _this.context; };
|
|
9
|
+
const shared = globalThis.ApiMakerDevise;
|
|
10
|
+
class DeviseScope {
|
|
11
|
+
constructor(scope, args) {
|
|
88
12
|
this.args = args;
|
|
89
|
-
this.context =
|
|
13
|
+
this.context = createContext();
|
|
90
14
|
this.scope = scope;
|
|
91
15
|
}
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
16
|
+
getContext = () => this.context;
|
|
17
|
+
}
|
|
18
|
+
export default class ApiMakerDevise {
|
|
19
|
+
static callSignOutEvent(args) {
|
|
20
|
+
events.emit("onDeviseSignOut", { args });
|
|
97
21
|
}
|
|
98
|
-
|
|
99
|
-
events_js_1.default.emit("onDeviseSignOut", { args: args });
|
|
100
|
-
};
|
|
101
|
-
ApiMakerDevise.current = function () {
|
|
22
|
+
static current() {
|
|
102
23
|
if (!shared.currentApiMakerDevise) {
|
|
103
24
|
shared.currentApiMakerDevise = new ApiMakerDevise();
|
|
104
25
|
}
|
|
105
26
|
return shared.currentApiMakerDevise;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
ApiMakerDevise[
|
|
119
|
-
ApiMakerDevise[
|
|
120
|
-
ApiMakerDevise[
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var getScopeName = "get".concat(scopeCamelized, "Scope");
|
|
27
|
+
}
|
|
28
|
+
static events() {
|
|
29
|
+
return events;
|
|
30
|
+
}
|
|
31
|
+
static addUserScope(scope, args = {}) {
|
|
32
|
+
const scopeCamelized = inflection.camelize(scope);
|
|
33
|
+
const currentMethodName = `current${scopeCamelized}`;
|
|
34
|
+
const isSignedInMethodName = `is${scopeCamelized}SignedIn`;
|
|
35
|
+
const getArgsMethodName = `get${scopeCamelized}Args`;
|
|
36
|
+
const getScopeName = `get${scopeCamelized}Scope`;
|
|
37
|
+
const scopeInstance = new DeviseScope(scope, args);
|
|
38
|
+
ApiMakerDevise[currentMethodName] = () => ApiMakerDevise.current().getCurrentScope(scope);
|
|
39
|
+
ApiMakerDevise[isSignedInMethodName] = () => Boolean(ApiMakerDevise.current().getCurrentScope(scope));
|
|
40
|
+
ApiMakerDevise[getArgsMethodName] = () => args;
|
|
41
|
+
ApiMakerDevise[getScopeName] = () => scopeInstance;
|
|
42
|
+
}
|
|
43
|
+
static getScope(scope) {
|
|
44
|
+
const scopeCamelized = inflection.camelize(scope);
|
|
45
|
+
const getScopeName = `get${scopeCamelized}Scope`;
|
|
126
46
|
return ApiMakerDevise[getScopeName]();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return __awaiter(this, arguments, void 0, function (username, password, args) {
|
|
130
|
-
var postData, response, model;
|
|
131
|
-
if (args === void 0) { args = {}; }
|
|
132
|
-
return __generator(this, function (_a) {
|
|
133
|
-
switch (_a.label) {
|
|
134
|
-
case 0:
|
|
135
|
-
if (!args.scope)
|
|
136
|
-
args.scope = "user";
|
|
137
|
-
postData = { username: username, password: password, args: args };
|
|
138
|
-
return [4 /*yield*/, services_js_1.default.current().sendRequest("Devise::SignIn", postData)];
|
|
139
|
-
case 1:
|
|
140
|
-
response = _a.sent();
|
|
141
|
-
model = response.model;
|
|
142
|
-
if (Array.isArray(model))
|
|
143
|
-
model = model[0];
|
|
144
|
-
ApiMakerDevise.updateSession(model);
|
|
145
|
-
events_js_1.default.emit("onDeviseSignIn", Object.assign({ username: username }, args));
|
|
146
|
-
return [2 /*return*/, { model: model, response: response }];
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
ApiMakerDevise.updateSession = function (model, args) {
|
|
152
|
-
if (args === void 0) { args = {}; }
|
|
47
|
+
}
|
|
48
|
+
static async signIn(username, password, args = {}) {
|
|
153
49
|
if (!args.scope)
|
|
154
50
|
args.scope = "user";
|
|
155
|
-
|
|
51
|
+
const postData = { username, password, args };
|
|
52
|
+
const response = await Services.current().sendRequest("Devise::SignIn", postData);
|
|
53
|
+
let model = response.model;
|
|
54
|
+
if (Array.isArray(model))
|
|
55
|
+
model = model[0];
|
|
56
|
+
ApiMakerDevise.updateSession(model);
|
|
57
|
+
events.emit("onDeviseSignIn", Object.assign({ username }, args));
|
|
58
|
+
return { model, response };
|
|
59
|
+
}
|
|
60
|
+
static updateSession(model, args = {}) {
|
|
61
|
+
if (!args.scope)
|
|
62
|
+
args.scope = "user";
|
|
63
|
+
const camelizedScopeName = inflection.camelize(args.scope, true);
|
|
156
64
|
ApiMakerDevise.current().currents[camelizedScopeName] = model;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
65
|
+
}
|
|
66
|
+
hasCurrentScope(scope) {
|
|
67
|
+
const camelizedScopeName = inflection.camelize(scope, true);
|
|
160
68
|
return camelizedScopeName in ApiMakerDevise.current().currents;
|
|
161
|
-
}
|
|
162
|
-
|
|
69
|
+
}
|
|
70
|
+
static setSignedOut(args) {
|
|
163
71
|
ApiMakerDevise.current().currents[inflection.camelize(args.scope, true)] = null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
shared.apiMakerSessionStatusUpdater.updateSessionStatus();
|
|
183
|
-
}
|
|
184
|
-
ApiMakerDevise.setSignedOut(args);
|
|
185
|
-
ApiMakerDevise.callSignOutEvent(args);
|
|
186
|
-
return [2 /*return*/, response];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
ApiMakerDevise.prototype.getCurrentScope = function (scope) {
|
|
72
|
+
}
|
|
73
|
+
static async signOut(args = {}) {
|
|
74
|
+
if (!args.scope) {
|
|
75
|
+
args.scope = "user";
|
|
76
|
+
}
|
|
77
|
+
const response = await Services.current().sendRequest("Devise::SignOut", { args });
|
|
78
|
+
// Cannot use the class because they would both import each other
|
|
79
|
+
if (shared.apiMakerSessionStatusUpdater) {
|
|
80
|
+
shared.apiMakerSessionStatusUpdater.updateSessionStatus();
|
|
81
|
+
}
|
|
82
|
+
ApiMakerDevise.setSignedOut(args);
|
|
83
|
+
ApiMakerDevise.callSignOutEvent(args);
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
constructor() {
|
|
87
|
+
this.currents = {};
|
|
88
|
+
}
|
|
89
|
+
getCurrentScope(scope) {
|
|
192
90
|
if (!(scope in this.currents)) {
|
|
193
91
|
this.currents[scope] = this.loadCurrentScope(scope);
|
|
194
92
|
}
|
|
195
93
|
return this.currents[scope];
|
|
196
|
-
}
|
|
197
|
-
|
|
94
|
+
}
|
|
95
|
+
hasGlobalCurrentScope(scope) {
|
|
198
96
|
if (globalThis.apiMakerDeviseCurrent && scope in globalThis.apiMakerDeviseCurrent) {
|
|
199
97
|
return true;
|
|
200
98
|
}
|
|
201
99
|
return false;
|
|
202
|
-
}
|
|
203
|
-
|
|
100
|
+
}
|
|
101
|
+
loadCurrentScope(scope) {
|
|
204
102
|
if (!this.hasGlobalCurrentScope(scope)) {
|
|
205
103
|
return null;
|
|
206
104
|
}
|
|
207
|
-
|
|
105
|
+
const scopeData = globalThis.apiMakerDeviseCurrent[scope];
|
|
208
106
|
if (!scopeData)
|
|
209
107
|
return null;
|
|
210
|
-
|
|
108
|
+
const parsedScopeData = Deserializer.parse(scopeData);
|
|
211
109
|
// Might be a collection with preloaded relationships
|
|
212
110
|
if (Array.isArray(parsedScopeData))
|
|
213
111
|
return parsedScopeData[0];
|
|
214
|
-
|
|
215
|
-
|
|
112
|
+
const ModelClass = modelClassRequire(scope);
|
|
113
|
+
const modelInstance = new ModelClass({ data: parsedScopeData });
|
|
216
114
|
return modelInstance;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
}());
|
|
220
|
-
exports.default = ApiMakerDevise;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
221
117
|
//# sourceMappingURL=devise.js.map
|